grid_new.htm
  1. <html> 
  2. <head>
  3. <title>grid_new</title> 
  4. <META http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. </head>
  6. <body> 
  7. <script> 
  8.   window.location="index.php?nmgp_outra_jan=true&nmgp_start=SC" ; 
  9. </script> 
  10. </body> 
  11. </html> 
Return
grid_new.php
  1. <?php 
  2.   include_once('../grid_new/index.php'); 
  3. ?> 
Return
grid_new_ajax.js
  1.   function nmAjaxShowDebug(oTemp)
  2.   {
  3.     if (!document.getElementById("id_debug_window")) {
  4.       return;
  5.     }
  6.     if (oTemp && oTemp != null) {
  7.         oResp = oTemp;
  8.     }
  9.     if (oResp["htmOutput"] && "" != oResp["htmOutput"]) {
  10.       document.getElementById("id_debug_window").style.display = "";
  11.       document.getElementById("id_debug_text").innerHTML = nmAjaxFormatDebug(oResp["htmOutput"]) + document.getElementById("id_debug_text").innerHTML;
  12.       nmCenterElement(document.getElementById("id_debug_window"));
  13.     }
  14.   }
  15.   function nmAjaxFormatDebug(sDebugMsg)
  16.   {
  17.     return "<table class=\"scFormMessageTable\" style=\"margin: 1px; width: 100%\"><tr><td class=\"scFormMessageMessage\">" + nmAjaxSpecCharParser(sDebugMsg) + "</td></tr></table>";
  18.   }
  19.   function nmAjaxHideDebug()
  20.   {
  21.     if (document.getElementById("id_debug_window")) {
  22.       document.getElementById("id_debug_window").style.display = "none";
  23.       document.getElementById("id_debug_text").innerHTML = "";
  24.     }
  25.   }
  26.   function nmCenterElement(oElem)
  27.   {
  28.     var $oElem    = $(oElem),
  29.         $oWindow  = $(this),
  30.         iElemTop  = Math.round(($oWindow.height() - $oElem.height()) / 2),
  31.         iElemLeft = Math.round(($oWindow.width()  - $oElem.width())  / 2);
  32.     $oElem.offset({top: iElemTop, left: iElemLeft});
  33.   }
  34.   function nmAjaxShowAutocomp(sFrameId)
  35.   {
  36.     if (document.getElementById("id_ac_frame_" + sFrameId)) {
  37.       document.getElementById("id_ac_frame_" + sFrameId).style.display = "";
  38.       document.getElementById("id_ac_" + sFrameId).focus();
  39.     }
  40.   }
  41.   function nmAjaxHideAutocomp(sFrameId)
  42.   {
  43.     if (document.getElementById("id_ac_frame_" + sFrameId)) {
  44.       document.getElementById("id_ac_frame_" + sFrameId).style.display = "none";
  45.     }
  46.   }
  47. var NM_index = 0;
  48. var NM_hidden = new Array();
  49. var NM_IE = (navigator.userAgent.indexOf('MSIE') > -1) ? 1 : 0;
  50. function NM_hitTest(o, l)
  51. {
  52.     function getOffset(o){
  53.         for(var r = {l: o.offsetLeft, t: o.offsetTop, r: o.offsetWidth, b: o.offsetHeight};
  54.             o = o.offsetParent; r.l += o.offsetLeft, r.t += o.offsetTop);
  55.         return r.r += r.l, r.b += r.t, r;
  56.     }
  57.     for(var b, s, r = [], a = getOffset(o), j = isNaN(l.length), i = (j ? l = [l] : l).length; i;
  58.         b = getOffset(l[--i]), (a.l == b.l || (a.l > b.l ? a.l <= b.r : b.l <= a.r))
  59.         && (a.t == b.t || (a.t > b.t ? a.t <= b.b : b.t <= a.b)) && (r[r.length] = l[i]));
  60.     return j ? !!r.length : r;
  61. }
  62. var tem_obj = false;
  63. function NM_show_menu(nn)
  64. {
  65.     if (!NM_IE)
  66.     {
  67.          return;
  68.     }
  69.     x = document.getElementById(nn);
  70.     x.style.display = "block";
  71.     obj_sel = document.body;
  72.     tem_obj = true;
  73.     x.ieFix = NM_hitTest(x, obj_sel.getElementsByTagName("select"));
  74.     for (i = 0; i <  x.ieFix.length; i++)
  75.     {
  76.       if (x.ieFix[i].style.visibility != "hidden")
  77.       {
  78.           x.ieFix[i].style.visibility = "hidden";
  79.           NM_hidden[NM_index] = x.ieFix[i];
  80.           NM_index++;
  81.       }
  82.     }
  83. }
  84. function NM_hide_menu()
  85. {
  86.     if (!NM_IE)
  87.     {
  88.          return;
  89.     }
  90.     obj_del = document.body;
  91.     if (tem_obj && obj_del == obj_sel)
  92.     {
  93.         for(var i = NM_hidden.length; i; NM_hidden[--i].style.visibility = "visible");
  94.     }
  95.     NM_index = 0;
  96.     NM_hidden = new Array();
  97. }
  98.   function nmAjaxSpecCharParser(sParseString)
  99.   {
  100.     var ta = document.createElement("textarea");
  101.     ta.innerHTML = sParseString.replace(/</g, "&lt;").replace(/>/g, "&gt;");
  102.     return ta.value;
  103.   } 
  104.   function nmAjaxProcOn()
  105.   {
  106.     if (document.getElementById("id_div_process")) {
  107.       if ($ && $.blockUI) {
  108.         $.blockUI({
  109.           message: $("#id_div_process_block"),
  110.           overlayCSS: { backgroundColor: sc_ajaxBg },
  111.           css: {
  112.             borderColor: sc_ajaxBordC,
  113.             borderStyle: sc_ajaxBordS,
  114.             borderWidth: sc_ajaxBordW
  115.           }
  116.         });
  117.       }
  118.       else {
  119.         document.getElementById("id_div_process").style.display = "";
  120.         document.getElementById("id_fatal_error").style.display = "none";
  121.       }
  122.     }
  123.   }
  124.   function nmAjaxProcOff()
  125.   {
  126.     if (document.getElementById("id_div_process")) {
  127.       if ($ && $.unblockUI) {
  128.         $.unblockUI();
  129.       }
  130.       else {
  131.         document.getElementById("id_div_process").style.display = "none";
  132.       }
  133.     }
  134.   }
Return
grid_new_ajax_search.js

  1. // ---------- delete_filter
  2. function ajax_delete_filter(parm)
  3. {
  4.     nmAjaxProcOn();
  5.     $.ajax({
  6.       type: "POST",
  7.       url: "index.php",
  8.       data: "nmgp_opcao=ajax_filter_delete&script_case_init=" + document.F1.script_case_init.value + "&script_case_session=" + document.F1.script_case_session.value + "&NM_filters_del=" + parm
  9.      })
  10.      .done(function(json_del_fil) {
  11.         var i, oResp;
  12.         Tst_integrid = json_del_fil.trim();
  13.         if ("{" != Tst_integrid.substr(0, 1)) {
  14.             nmAjaxProcOff();
  15.             alert (json_del_fil);
  16.             return;
  17.         }
  18.         eval("oResp = " + json_del_fil);
  19.         if (oResp["ss_time_out"]) {
  20.             nmAjaxProcOff();
  21.             nm_move();
  22.         }
  23.         if (oResp["setValue"]) {
  24.           for (i = 0; i < oResp["setValue"].length; i++) {
  25.                $("#" + oResp["setValue"][i]["field"]).html(oResp["setValue"][i]["value"]);
  26.           }
  27.         }
  28.         nmAjaxProcOff();
  29.         var deleteFilterEvent = new Event('updatefilter');
  30.         document.dispatchEvent(deleteFilterEvent);
  31.     });
  32. }

  33. // ---------- save_filter
  34. function ajax_save_filter(save_name, save_opt, parm, pos)
  35. {
  36.     nmAjaxProcOn();
  37.     $.ajax({
  38.       type: "POST",
  39.       url: "index.php",
  40.       data: "nmgp_opcao=ajax_filter_save&script_case_init=" + document.F1.script_case_init.value + "&script_case_session=" + document.F1.script_case_session.value + "&nmgp_save_name=" + save_name + "&nmgp_save_option=" + save_opt + "&NM_filters_save=" + parm
  41.      })
  42.      .done(function(json_save_fil) {
  43.         var i, oResp;
  44.         Tst_integrid = json_save_fil.trim();
  45.         if ("{" != Tst_integrid.substr(0, 1)) {
  46.             nmAjaxProcOff();
  47.             alert (json_save_fil);
  48.             return;
  49.         }
  50.         eval("oResp = " + json_save_fil);
  51.         if (oResp["ss_time_out"]) {
  52.             nmAjaxProcOff();
  53.             nm_move();
  54.         }
  55.         if (oResp["setValue"]) {
  56.           for (i = 0; i < oResp["setValue"].length; i++) {
  57.                $("#" + oResp["setValue"][i]["field"]).html(oResp["setValue"][i]["value"]);
  58.           }
  59.         }
  60.         if (oResp["htmOutput"]) {
  61.             nmAjaxShowDebug(oResp);
  62.          }
  63.         document.getElementById('sel_recup_filters_' + pos).selectedIndex = -1;
  64.         document.getElementById('sel_filters_del_' + pos).selectedIndex = -1;
  65.         document.getElementById('SC_nmgp_save_name_' + pos).value = '';
  66.         document.getElementById('Apaga_filters_' + pos).style.display = '';
  67.         document.getElementById('sel_recup_filters_' + pos).style.display = '';
  68.         document.getElementById('Salvar_filters_' + pos).style.display = 'none';
  69.         nmAjaxProcOff();
  70.         var saveFilterEvent = new Event('updatefilter');
  71.         document.dispatchEvent(saveFilterEvent);
  72.     });
  73. }

  74. // ---------- select_filter
  75. var Table_sv_fil = new Array();
  76. Table_sv_fil[0] = "proprietarios_idproprietario";
  77. Table_sv_fil[1] = "proprietarios_nome";
  78. Table_sv_fil[2] = "proprietarios_sexo";
  79. Table_sv_fil[3] = "proprietarios_cpf";
  80. function ajax_select_filter(parm)
  81. {
  82.     nmAjaxProcOn();
  83.     $.ajax({
  84.       type: "POST", async:false,
  85.       url: "index.php",
  86.       data: "nmgp_opcao=ajax_filter_select&script_case_init=" + document.F1.script_case_init.value + "&script_case_session=" + document.F1.script_case_session.value + "&NM_filters=" + parm
  87.      })
  88.      .done(function(json_sel_fil) {
  89.         var i, oResp;
  90.         Tst_integrid = json_sel_fil.trim();
  91.         if ("{" != Tst_integrid.substr(0, 1)) {
  92.             nmAjaxProcOff();
  93.             alert (json_sel_fil);
  94.             return;
  95.         }
  96.         eval("oResp = " + json_sel_fil);
  97.         if (oResp["ss_time_out"]) {
  98.             nmAjaxProcOff();
  99.             nm_move();
  100.         }
  101.         if (oResp["set_val"]) {
  102.           for (i = 0; i < oResp["set_val"].length; i++) {
  103.                $("#" + oResp["set_val"][i]["field"]).val(oResp["set_val"][i]["value"]);
  104.           }
  105.         }
  106.         if (oResp["set_html"]) {
  107.           for (i = 0; i < oResp["set_html"].length; i++) {
  108.                $("#" + oResp["set_html"][i]["field"]).html(oResp["set_html"][i]["value"]);
  109.           }
  110.         }
  111.         if (oResp["setVar"]) {
  112.           for (i = 0; i < oResp["setVar"].length; i++) {
  113.                eval (oResp["setVar"][i]["var"] + ' = \"' + oResp["setVar"][i]["value"] + '\"');
  114.           }
  115.         }
  116.         if (oResp["set_radio"]) {
  117.           for (i = 0; i < oResp["set_radio"].length; i++) {
  118.                if ($("#" + oResp["set_radio"][i]["field"])) {
  119.                    $("#" + oResp["set_radio"][i]["field"]).removeAttr('checked');
  120.                    $('input[id="' + oResp["set_radio"][i]["field"] + '"][value="' + oResp["set_radio"][i]["value"] + '"]').prop('checked', true);
  121.               }
  122.           }
  123.         }
  124.         if (oResp["set_checkbox"]) {
  125.           for (i = 0; i < oResp["set_checkbox"].length; i++) {
  126.               var cmp_ck = oResp["set_checkbox"][i]["field"].substr(3) + "[]";
  127.               if (document.F1.elements[cmp_ck]) {
  128.                   var obj_check = document.F1.elements[cmp_ck];
  129.                   if (obj_check.length == undefined) {
  130.                       document.F1.elements[cmp_ck].checked = false;
  131.                       for (y = 0; y < oResp["set_checkbox"][i]["value"].length; y++) {
  132.                           if (document.F1.elements[cmp_ck].value == oResp["set_checkbox"][i]["value"][y]) {
  133.                               document.F1.elements[cmp_ck].checked = true;
  134.                           }
  135.                       }
  136.                   }
  137.                   if (obj_check.length != undefined) {
  138.                       for (x = 0; x < obj_check.length; x++) {
  139.                           obj_check[x].checked = false;
  140.                       }
  141.                       for (x = 0; x < obj_check.length; x++) {
  142.                           for (y = 0; y < oResp["set_checkbox"][i]["value"].length; y++) {
  143.                               if (obj_check[x].value == oResp["set_checkbox"][i]["value"][y]) {
  144.                                   obj_check[x].checked = true;
  145.                               }
  146.                           }
  147.                       }
  148.                   }
  149.               }
  150.           }
  151.         }
  152.         if (oResp["set_selmult"]) {
  153.           for (i = 0; i < oResp["set_selmult"].length; i++) {
  154.              var obj_sel = document.getElementById(oResp["set_selmult"][i]["field"]);
  155.              for (x = 0; x < obj_sel.length; x++) {
  156.                  if (obj_sel[x].selected) {
  157.                     obj_sel[x].selected = false;
  158.                  }
  159.              }
  160.              for (x = 0; x < obj_sel.length; x++) {
  161.                  for (y = 0; y < oResp["set_selmult"][i]["value"].length; y++) {
  162.                      if (obj_sel[x].value == oResp["set_selmult"][i]["value"][y]) {
  163.                          obj_sel[x].selected = true;
  164.                      }
  165.                  }
  166.              }
  167.           }
  168.         }
  169.         if (oResp["set_ddcheckbox"]) {
  170.           for (i = 0; i < oResp["set_ddcheckbox"].length; i++) {
  171.              var obj_sel = document.getElementById(oResp["set_ddcheckbox"][i]["field"]);
  172.              var cmp_chk = oResp["set_ddcheckbox"][i]["field"].substring(3);
  173.              $('#' + oResp["set_ddcheckbox"][i]["field"]).dropdownchecklist('destroy');
  174.              $('#' + oResp["set_ddcheckbox"][i]["field"] + ' option').each(function() {
  175.                 $(this).attr('selected',false);
  176.              });
  177.              for (x = 0; x < obj_sel.length; x++) {
  178.                  for (y = 0; y < oResp["set_ddcheckbox"][i]["value"].length; y++) {
  179.                      if (obj_sel[x].value == oResp["set_ddcheckbox"][i]["value"][y]) {
  180.                          obj_sel[x].selected = true;
  181.                      }
  182.                  }
  183.              }
  184.           }
  185.           Sc_carga_ddcheckbox(cmp_chk);
  186.         }
  187.         if (oResp["set_dselect"]) {
  188.           for (i = 0; i < oResp["set_dselect"].length; i++) {
  189.               var obj_sel_orig = document.getElementById(oResp["set_dselect"][i]["field"] + "_orig");
  190.               var obj_sel_dest = document.getElementById(oResp["set_dselect"][i]["field"] + "_dest");
  191.               obj_sel_dest.length = 0
  192.               for (x = 0; x < obj_sel_orig.length; x++) {
  193.                      obj_sel_orig[x].disabled = false;
  194.                      obj_sel_orig[x].style.color = "";
  195.               }
  196.               var ind = 0;
  197.               for (y = 0; y < oResp["set_dselect"][i]["value"].length; y++) {
  198.                  for (x = 0; x < obj_sel_orig.length; x++) {
  199.                      if (obj_sel_orig[x].value == oResp["set_dselect"][i]["value"][y]["opt"]) {
  200.                          obj_sel_orig[x].disabled = true;
  201.                          obj_sel_orig[x].style.color = "#A0A0A0";
  202.                          obj_sel_dest.options[ind] = new Option(oResp["set_dselect"][i]["value"][y]["value"], oResp["set_dselect"][i]["value"][y]["opt"]);
  203.                          ind++;
  204.                      }
  205.                  }
  206.              }
  207.           }
  208.         }
  209.         if (oResp["set_select2_aut"]) {
  210.           for (i = 0; i < oResp["set_select2_aut"].length; i++) {
  211.                $("#" + oResp["set_select2_aut"][i]["field"]).val(null).trigger('change');
  212.                var newOption = new Option(oResp["set_select2_aut"][i]["value"], oResp["set_select2_aut"][i]["value"], true, true);
  213.                $("#" + oResp["set_select2_aut"][i]["field"]).append(newOption);
  214.           }
  215.         }
  216.         if (oResp["set_fil_order"]) {
  217.           for (i = 0; i < oResp["set_fil_order"].length; i++) {
  218.               var obj_sel_orig = document.getElementById(oResp["set_fil_order"][i]["field"] + "_orig");
  219.               var obj_sel_dest = document.getElementById(oResp["set_fil_order"][i]["field"] + "_dest");
  220.               obj_sel_dest.length = 0
  221.               for (x = 0; x < obj_sel_orig.length; x++) {
  222.                      obj_sel_orig[x].disabled = false;
  223.                      obj_sel_orig[x].style.color = "";
  224.               }
  225.               var ind = 0;
  226.               for (y = 0; y < oResp["set_fil_order"][i]["value"].length; y++) {
  227.                  for (x = 0; x < obj_sel_orig.length; x++) {
  228.                      if (obj_sel_orig[x].value == oResp["set_fil_order"][i]["value"][y].substr(1)) {
  229.                          obj_sel_orig[x].disabled = true;
  230.                          obj_sel_orig[x].style.color = "#A0A0A0";
  231.                          obj_sel_dest.options[ind] = new Option(oResp["set_fil_order"][i]["value"][y], oResp["set_fil_order"][i]["value"][y]);
  232.                          ind++;
  233.                      }
  234.                  }
  235.              }
  236.           }
  237.         }
  238.         for (i = 0; i < Table_sv_fil.length; i++) {
  239.            if (document.getElementById('id_vis_' + Table_sv_fil[i])) {
  240.               if (search_get_sel_txt("SC_" + Table_sv_fil[i] + "_cond") == "bw") {
  241.                  document.getElementById('id_vis_' + Table_sv_fil[i]).style.display ='';
  242.               }
  243.               else {
  244.                  document.getElementById('id_vis_' + Table_sv_fil[i]).style.display ='none';
  245.               }
  246.            }
  247.         }
  248.         nmAjaxProcOff();
  249.     });
  250. }
Return
grid_new_config_csv.php
  1. <?php
  2. /**
  3.  * $Id: nm_gp_config_csv.php,v 1.2 2018-11-16 13:02:59 sergio Exp $
  4.  */
  5.     include_once('grid_new_session.php');
  6.     session_start();
  7.     $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  8.     //check tmp
  9.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  10.     {
  11.         $str_path_apl_url $_SERVER['PHP_SELF'];
  12.         $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  13.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  14.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  15.         /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  16.     }
  17.     $SC_cod_proj "Projeto7";
  18.     $SC_apl_proc "grid_new";
  19.     $SC_conf_opt explode(",","tem_res_cons,tem_res_res,nm_delim_line,nm_delim_col,nm_delim_dados,nm_label_csv");
  20. /* sc_apl_default */
  21.     if (!isset($_SESSION['sc_session']))
  22.     {
  23.         $NM_dir_atual getcwd();
  24.         if (empty($NM_dir_atual))
  25.         {
  26.             $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  27.             $str_path_sys  str_replace("\\"'/'$str_path_sys);
  28.         }
  29.         else
  30.         {
  31.             $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  32.             $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  33.         }
  34.         $str_path_web    $_SERVER['PHP_SELF'];
  35.         $str_path_web    str_replace("\\"'/'$str_path_web);
  36.         $str_path_web    str_replace('//''/'$str_path_web);
  37.         $root            substr($str_path_sys0, -strlen($str_path_web));
  38.         if (is_file($root $_SESSION['scriptcase'][$SC_apl_proc]['glo_nm_path_imag_temp'] . "/sc_apl_default_" $SC_cod_proj ".txt"))
  39.         {
  40. ?>
  41.             <script language="javascript">
  42.                parent.nm_move();
  43.             </script>
  44. <?php
  45.             exit;
  46.         }
  47.     }
  48.     $delim_line  = (isset($_GET['nm_delim_line']))  ? $_GET['nm_delim_line']  : "1";
  49.     $delim_col   = (isset($_GET['nm_delim_col']))   ? $_GET['nm_delim_col']   : "1";
  50.     $delim_dados = (isset($_GET['nm_delim_dados'])) ? $_GET['nm_delim_dados'] : "1";
  51.     $label_csv   = (isset($_GET['nm_label_csv']))   ? $_GET['nm_label_csv']   : "N";
  52.     $language    = (isset($_GET['language']))       ? $_GET['language']       : "port";
  53.     $origem      = (isset($_GET['origem']))         ? $_GET['origem']         : "cons";
  54.     $res_cons    = (isset($_GET['nm_res_cons']))    ? $_GET['nm_res_cons']    : "n";
  55.     $password    = (isset($_GET['password']))       ? $_GET['password']       : "s";
  56.     $ini_csv_res  explode(","$_GET['nm_ini_csv_res']);
  57.     $all_modules  explode(","$_GET['nm_all_modules']);
  58. /*--- exportacoes ajax */
  59.     $export_ajax = (isset($_GET['export_ajax'])) ? $_GET['export_ajax'] : 'N';
  60. /*--------*/
  61.     $script_case_init = (isset($_GET['script_case_init'])) ? filter_input(INPUT_GET'script_case_init'FILTER_SANITIZE_NUMBER_INT) : 'N';
  62.     $hasSelColumns= (isset($_GET['summary_export_columns']))  ? 'S' == filter_input(INPUT_GET'summary_export_columns'FILTER_SANITIZE_STRING) : false;
  63.     if (isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'])) {
  64.         foreach ($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'] as $ind => $cada_cmp) {
  65.             if (!isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['labels'][$cada_cmp])) {
  66.                $hasSelColumns false;
  67.             }
  68.         }
  69.     }
  70.     else {
  71.          $hasSelColumns false;
  72.     }
  73. /*
  74.     if (!in_array("campos_sel", $SC_conf_opt)) {
  75.         $hasSelColumns = false;
  76.     }
  77. */
  78.     ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  79.     if (!function_exists("NM_is_utf8"))
  80.     {
  81.         include_once("../_lib/lib/php/nm_utf8.php");
  82.     }

  83.     $tradutor = array();
  84.     if (isset($_SESSION['scriptcase']['sc_idioma_csv']))
  85.     {
  86.         $tradutor $_SESSION['scriptcase']['sc_idioma_csv'];
  87.     }
  88.     if (!isset($tradutor[$language]))
  89.     {
  90.         foreach ($tradutor as $language => $resto)
  91.         {
  92.             break;
  93.         }
  94.     }
  95.     if (!isset($tradutor[$language]))
  96.     {
  97.        exit;
  98.     }

  99. ?>
  100. <html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  101. <head>
  102.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html']; ?>" />
  103. <?php
  104. if ((isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])  || (isset($_SESSION['scriptcase']['device_mobile']) && $_SESSION['scriptcase']['device_mobile'] && $_SESSION['scriptcase']['display_mobile']))
  105. {
  106. ?>
  107.  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  108. <?php
  109. }
  110. ?>
  111. <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" />
  112.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" />
  113.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab'?>" />
  114.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab_dir'?>" />
  115.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div'?>" />
  116.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div_dir'?>" />
  117.  <?php
  118.   if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  119.   {
  120.     ?>
  121.     <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts']; ?>" />
  122.     <?php
  123.   }
  124.  ?>
  125.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" />
  126.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" />
  127. </head>
  128. <body class="scGridPage" style="margin: 0px; overflow-x: hidden">

  129. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  130. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery-ui.js"></script>
  131. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>

  132. <form name="config_csv" method="post" action="" autocomplete="off">
  133. <?php
  134. $pos "left";
  135. if ($_SESSION['scriptcase']['reg_conf']['html_dir'] == " DIR='RTL'")
  136. {
  137.     $pos "right";
  138. }
  139. ?>
  140. <table id="main_table" class="exportConfig" style="position: relative; top: 20px; <?php echo $pos?>: 20px">
  141. <tr>
  142.  <td align="center">

  143.   <div id="tabs">
  144.     <ul class="scAppDivTabLine" style="display:<?php echo ($hasSelColumns)?"":"none"?>">
  145.       <li class="scTabActive"><a href="#tabs-general"><?php echo $tradutor[$language]['titulo']; ?></a></li>
  146.       <li class="scTabInactive"><a href="#tabs-sel-columns"><?php echo $tradutor[$language]['titulo_colunas']; ?></a></li>
  147.     </ul>
  148.     <div id="tabs-general" style="padding: 0px; margin: 0px">

  149.       <table class="scGridBorder" width='100%' cellspacing="0" cellpadding="0">
  150.           <tr style="display:<?php echo ($hasSelColumns)?"none":""?>">
  151.             <td colspan=2 class="scGridLabelVert"><?php echo $tradutor[$language]['titulo']; ?></td>
  152.           </tr>
  153.           <tr><td nowrap class='scGridToolbar' colspan=2 style='font-weight: bold;'><?php echo $tradutor[$language]['group_general']; ?></td></tr>

  154.       <?php
  155.       if ($res_cons == "s" && $origem != "chart")
  156.       {
  157.           $Opt_display = (($origem == 'cons' && !in_array("tem_res_cons"$SC_conf_opt)) || ($origem == 'res' && !in_array("tem_res_res"$SC_conf_opt))) ? true false;
  158.       ?>
  159.        <tr<?php echo $Opt_display ?>>
  160.          <td nowrap class="scGridFieldOddFont" align="left">
  161.              <?php echo $tradutor[$language]['modules']; ?>
  162.          </td>
  163.          <td nowrap class="scGridFieldOddFont" align="left">
  164.           <div class="input-group input-group-horizontal">
  165.           <?php
  166.              foreach ($all_modules as $cada_mod)
  167.              {
  168.                  if ($cada_mod != 'chart')
  169.                  {
  170.                      $ckeck = (in_array($cada_mod$ini_csv_res)) ? "checked" "";
  171.                  ?>
  172.                     <label>
  173.                     <input type=checkbox id="id_tem_res_cons" name="tem_res_cons[]"  <?php echo $ckeck ?> value="<?php echo $cada_mod ?>"><?php echo $tradutor[$language]['mod_' $cada_mod]; ?>
  174.                      </label>

  175.                  <?php
  176.                  }
  177.              }
  178.           ?>
  179.         </div>
  180.          </td>
  181.       </tr>
  182.       <?php
  183.       }
  184.         $Opt_display = (!in_array("nm_delim_line"$SC_conf_opt)) ? ' style="display: none"' '';
  185.       ?>
  186.          <tr<?php echo $Opt_display ?>>
  187.            <td class="scGridFieldOddFont" align="left">
  188.                <?php echo $tradutor[$language]['delim_line']; ?>
  189.            </td>
  190.            <td class="scGridFieldOddFont" align="left">
  191.             <SELECT id="id_delim_line" name="nm_delim_line" size="1">
  192.         <?php
  193.            $ckeck = ($delim_line == "1") ? "selected" "";
  194.         ?>
  195.               <option value="1" <?php echo $ckeck ?>>CRLF
  196.         <?php
  197.            $ckeck = ($delim_line == "2") ? "selected" "";
  198.         ?>
  199.               <option value="2" <?php echo $ckeck ?>>CR
  200.         <?php
  201.            $ckeck = ($delim_line == "3") ? "selected" "";
  202.         ?>
  203.               <option value="3" <?php echo $ckeck ?>>LF
  204.             </SELECT>
  205.            </td>
  206.          </tr>

  207.         <?php
  208.            $Opt_display = (!in_array("nm_delim_col"$SC_conf_opt)) ? ' style="display: none"' '';
  209.         ?>
  210.          <tr<?php echo $Opt_display ?>>
  211.            <td class="scGridFieldOddFont" align="left">
  212.                <?php echo $tradutor[$language]['delim_col']; ?>
  213.            </td>
  214.            <td class="scGridFieldOddFont" align="left">
  215.             <SELECT id="id_delim_col" name="nm_delim_col" size="1">
  216.         <?php
  217.            $ckeck = ($delim_col == "1") ? "selected" "";
  218.         ?>
  219.               <option value="1" <?php echo $ckeck ?>>;
  220.         <?php
  221.            $ckeck = ($delim_col == "2") ? "selected" "";
  222.         ?>
  223.               <option value="2" <?php echo $ckeck ?>>,
  224.         <?php
  225.            $ckeck = ($delim_col == "3") ? "selected" "";
  226.         ?>
  227.               <option value="3" <?php echo $ckeck ?>>Tab
  228.         <?php
  229.            $ckeck = ($delim_col == "4") ? "selected" "";
  230.         ?>
  231.               <option value="4" <?php echo $ckeck ?>>#
  232.         <?php
  233.            $ckeck = ($delim_col == "5") ? "selected" "";
  234.         ?>
  235.               <option value="5" <?php echo $ckeck ?>>None
  236.             </SELECT>
  237.            </td>
  238.          </tr>

  239.         <?php
  240.            $Opt_display = (!in_array("nm_delim_dados"$SC_conf_opt)) ? ' style="display: none"' '';
  241.         ?>
  242.          <tr<?php echo $Opt_display ?>>
  243.            <td class="scGridFieldOddFont" align="left">
  244.                <?php echo $tradutor[$language]['delim_dados']; ?>
  245.            </td>
  246.            <td class="scGridFieldOddFont" align="left">
  247.             <SELECT id="id_delim_dados" name="nm_delim_dados" size="1">
  248.         <?php
  249.            $ckeck = ($delim_dados == "1") ? "selected" "";
  250.         ?>
  251.               <option value="1" <?php echo $ckeck ?>>"
  252.         <?php
  253.            $ckeck = ($delim_dados == "2") ? "selected" "";
  254.         ?>
  255.               <option value="2" <?php echo $ckeck ?>>'
  256.         <?php
  257.            $ckeck = ($delim_dados == "4") ? "selected" "";
  258.         ?>
  259.               <option value="4" <?php echo $ckeck ?>>|
  260.         <?php
  261.            $ckeck = ($delim_dados == "3") ? "selected" "";
  262.         ?>
  263.               <option value="3" <?php echo $ckeck ?>>None
  264.             </SELECT>
  265.            </td>
  266.          </tr>

  267.         <?php
  268.            $Opt_display = (!in_array("nm_label_csv"$SC_conf_opt)) ? ' style="display: none"' '';
  269.         ?>
  270.          <tr<?php echo $Opt_display ?>>
  271.            <td class="scGridFieldOddFont" align="left">
  272.                <?php echo $tradutor[$language]['label_csv']; ?>
  273.            </td>
  274.            <td class="scGridFieldOddFont" align="left">
  275.             <div class="input-group input-group-horizontal">
  276.         <?php
  277.            $ckeck = ($label_csv == "S") ? "checked" "";
  278.         ?>
  279.              <label><input type=checkbox id="id_nm_label_csv" name="nm_label_csv[]" <?php echo $ckeck ?>></label>
  280.               </div>
  281.              </td>
  282.          </tr>
  283.      <?php
  284.       if ($password == "s")
  285.       {
  286. /*         $Opt_display = (!in_array("password", $SC_conf_opt)) ? ' style="display: none"' : ''; */
  287.          $Opt_display = (!in_array("password"$SC_conf_opt)) ? '' '';
  288.      ?>
  289.        <tr<?php echo $Opt_display ?>>
  290.          <td nowrap class="scGridFieldOddFont" align="left">
  291.              <?php echo $tradutor[$language]['password']; ?>
  292.          </td>
  293.          <td nowrap class="scGridFieldOddFont" align="left">
  294.            <input type=password name="password" value="" size=30> </td>
  295.       </tr>
  296.       <?php
  297.       }
  298.       ?>
  299.       </table>
  300.     </div>
  301.     <div id="tabs-sel-columns" style="padding: 0px; margin: 0px; display:none">

  302.         <?php
  303.         if($hasSelColumns)
  304.         {
  305.           $bol_sel_campos_include true;
  306.           if(!isset($app_name))
  307.           {
  308.             $app_name $SC_apl_proc;
  309.           }
  310.           include($app_name "_sel_campos.php");
  311.           $class_name = (is_numeric(substr($app_name01))) ? "_" $app_name $app_name;
  312.           $sel_campos $class_name "_sel_cmp";
  313.           $sel_campos = new $sel_campos($bol_sel_campos_include$script_case_init);
  314.           $sel_campos->Sel_cmp_init();
  315.           $sel_campos->Sel_cmp_init_fields();
  316.           $sel_campos->displayHtml(false);
  317.         }
  318.         ?>

  319.     </div>
  320.   </div>
  321.   <div class="buttons">
  322.     <?php
  323.     echo  $_SESSION['scriptcase']['bg_btn_popup']['bok'];
  324.     echo  "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  325.     echo  $_SESSION['scriptcase']['bg_btn_popup']['btbremove'];
  326.     ?>
  327.   </div>

  328.  </td>
  329.  </tr>
  330. </table>
  331. </form>


  332. <script language="javascript">
  333. var bFixed = false;
  334. function ajusta_window()
  335. {
  336.   var mt   = $(document.getElementById("main_table"));
  337.   var mt1  = $(document.getElementById("tabs-general"));
  338.   altura  = mt1.height();
  339.   largura = mt1.width();
  340.   if($('#tabs-sel-columns').length > 0)
  341.   {
  342.     mt2  = $(document.getElementById("tabs-sel-columns"));
  343.     if(mt2.height() > altura)
  344.     {
  345.       altura = mt2.height();
  346.     }
  347.     if(mt2.width() > largura)
  348.     {
  349.       largura = mt2.width();
  350.     }
  351.   }

  352.   //protect against max windows
  353.   if((altura + 220) > parent.window.innerHeight) altura = parent.window.innerHeight - 220;

  354.   if (0 == largura || 0 == altura)
  355.   {
  356.     setTimeout("ajusta_window()", 50);
  357.     return;
  358.   }
  359.   else if(!bFixed)
  360.   {
  361.     bFixed = true;
  362.     if (navigator.userAgent.indexOf("Chrome/") > 0)
  363.     {
  364.       self.parent.tb_resize(altura + 150, largura + 40);
  365.       setTimeout("ajusta_window()", 50);
  366.       return;
  367.     }
  368.   }
  369.   mt.width( largura );
  370.   self.parent.tb_resize(altura + 150, largura + 40);
  371. }

  372. $('#tabs > ul > li').click(function() {
  373.   if($(this).find("a").length)
  374.   {
  375.     $('#tabs > ul > li').removeClass("scTabActive");
  376.     $('#tabs > ul > li').addClass("scTabInactive");

  377.     $(this).removeClass("scTabInactive");
  378.     $(this).addClass("scTabActive");

  379.     $('#tabs > div').hide();
  380.     $($(this).find("a").attr("href")).show();
  381.   }
  382. });
  383. $( document ).ready(function() {
  384.    setTimeout("ajusta_window();$('#tabs > ul > li:first-child').click();", 50);
  385. <?php
  386.   if ($password == "s")
  387.   {
  388. ?>
  389.    document.config_csv.password.value = "";
  390. <?php
  391.   }
  392. ?>
  393. });

  394.   function scSubmitSelCamposAjaxExportDone()
  395.   {
  396.     saveSelColumns = true;
  397.     processa();
  398.   }

  399.   var saveSelColumns = false;
  400.   function processa()
  401.   {
  402.      <?php
  403.      if($hasSelColumns)
  404.      {
  405.       ?>
  406.       if(saveSelColumns == false)
  407.       {
  408.         scSubmitSelCamposAjaxExport();
  409.         return false;
  410.       }
  411.       <?php
  412.      }
  413.      ?>

  414.      <?php
  415.      if($export_ajax != "S" && $export_ajax != "R" && $export_ajax != "D")
  416.      {
  417.       ?>
  418.       self.parent.tb_remove();
  419.       <?php
  420.      }
  421.      ?>

  422.      delim_line  = document.config_csv.nm_delim_line.value;
  423.      delim_col   = document.config_csv.nm_delim_col.value;
  424.      delim_dados = document.config_csv.nm_delim_dados.value;
  425.      label_csv   = "N";
  426.      Nobj = document.getElementById('id_nm_label_csv').name;
  427.      obj  = document.getElementsByName(Nobj);
  428.      for (iCheck = 0; iCheck < obj.length; iCheck++) {
  429.         if (obj[iCheck].checked) {
  430.             label_csv = "S";
  431.             break;
  432.         }
  433.      }

  434.      res_cons = "";
  435.      if (document.config_csv.id_tem_res_cons)
  436.      {
  437.          Nobj = document.getElementById('id_tem_res_cons').name;
  438.          obj  = document.getElementsByName(Nobj);
  439.          for (iCheck = 0; iCheck < obj.length; iCheck++) {
  440.               if (obj[iCheck].checked) {
  441.                   if (res_cons != "") {
  442.                      res_cons += ",";
  443.                   }
  444.                   res_cons += obj[iCheck].value;
  445.               }
  446.          }
  447.      }
  448.      else
  449.      {
  450.          res_cons = "<?php if ($origem == "cons") {echo "grid";} else {echo "resume";} ?>";
  451.      }
  452.      if (res_cons == "")
  453.      {
  454.         return;
  455.      }

  456.      use_pass = "";
  457.      <?php
  458.      if($password == "s")
  459.      {
  460.       ?>
  461.          use_pass = document.config_csv.password.value;
  462.       <?php
  463.      }
  464.      ?>

  465. /*--- exportacoes ajax */
  466. <?php
  467.      if ($export_ajax == 'S') {
  468. ?>
  469.          parent.nm_gp_csv_conf(delim_line, delim_col, delim_dados, label_csv, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', 'csv', false);return false;
  470. <?php
  471.      }
  472.      else if ($export_ajax == 'R') {
  473. ?>
  474.          parent.nm_gp_csv_conf(delim_line, delim_col, delim_dados, label_csv, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', 'csv_res', false);return false;
  475. <?php
  476.      } else {
  477. ?>
  478.          parent.nm_gp_csv_conf(delim_line, delim_col, delim_dados, label_csv, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', '', false);return false;
  479. <?php
  480.      }
  481. ?>
  482. /*--------*/

  483.      $('#bsair').click();

  484.   }
  485. </script>
  486. <script>
  487.         //colocado aqui devido a execução modal não executar o ready do jquery
  488.       setTimeout("ajusta_window()", 50);
  489. </script>
  490. </body>
  491. </html>
Return
grid_new_config_graf_flash.php
  1. <?php
  2. /**
  3.  * $Id: nm_gp_config_graf_flash.php,v 1.8 2012-01-27 13:02:59 sergio Exp $
  4.  */
  5.     include_once('grid_new_session.php');
  6.     session_start();
  7.     $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  8.     //check tmp
  9.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  10.     {
  11.         $str_path_apl_url $_SERVER['PHP_SELF'];
  12.         $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  13.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  14.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  15.         /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  16.     }
  17.     $SC_cod_proj "Projeto7";
  18.     $SC_apl_proc "grid_new";
  19. /* sc_apl_default */
  20.     if (!isset($_SESSION['sc_session']))
  21.     {
  22.         $NM_dir_atual getcwd();
  23.         if (empty($NM_dir_atual))
  24.         {
  25.             $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  26.             $str_path_sys  str_replace("\\"'/'$str_path_sys);
  27.         }
  28.         else
  29.         {
  30.             $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  31.             $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  32.         }
  33.         $str_path_web    $_SERVER['PHP_SELF'];
  34.         $str_path_web    str_replace("\\"'/'$str_path_web);
  35.         $str_path_web    str_replace('//''/'$str_path_web);
  36.         $root            substr($str_path_sys0, -strlen($str_path_web));
  37.         if (is_file($root $_SESSION['scriptcase'][$SC_apl_proc]['glo_nm_path_imag_temp'] . "/sc_apl_default_" $SC_cod_proj ".txt"))
  38.         {
  39. ?>
  40.              <script language="javascript">
  41.                parent.nm_move();
  42.              </script>
  43. <?php
  44.             exit;
  45.         }
  46.     }
  47.     $nome_apl  = (isset($_GET['nome_apl']))  ? $_GET['nome_apl']  : "";
  48.     $campo_apl = (isset($_GET['campo_apl'])) ? $_GET['campo_apl'] : "nm_resumo_graf";
  49.     $sc_page   = (isset($_GET['sc_page']))   ? $_GET['sc_page']   : "";
  50.     $language  = (isset($_GET['language']))  ? $_GET['language']  : "port";
  51.     $tp_apl    = (isset($_GET['tp_apl']))    ? $_GET['tp_apl']    : "";

  52.     ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  53.     if (!function_exists("NM_is_utf8"))
  54.     {
  55.         include_once("../_lib/lib/php/nm_utf8.php");
  56.     }
  57.     if (!isset($_SESSION['sc_session'][$sc_page][$nome_apl]))
  58.     {
  59.        $sc_page  $_SESSION['scriptcase']['sc_page_process'];
  60.        $nome_apl $SC_apl_proc;
  61.     }

  62.     if (isset($_POST['bok_graf']) && $_POST['bok_graf'] == "OK")
  63.     {
  64.        $nome_apl  $_POST['nome_apl'];
  65.        $campo_apl $_POST['campo_apl'];
  66.        $sc_page   $_POST['sc_page'];
  67.        if (!isset($_SESSION['sc_session'][$sc_page][$nome_apl]))
  68.        {
  69.           $sc_page  $_SESSION['scriptcase']['sc_page_process'];
  70.           $nome_apl $SC_apl_proc;
  71.        }

  72.        if ($campo_apl == "nm_resumo_graf")
  73.        {
  74.            if (isset($_POST['tipo'])) {
  75.                $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_tipo']        = $_POST['tipo'];
  76.            }
  77.            if (isset($_POST['largura'])) {
  78.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_larg']        = $_POST['largura'];
  79.            }
  80.            if (isset($_POST['altura'])) {
  81.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_alt']         = $_POST['altura'];
  82.            }
  83.            if (isset($_POST['opc_atual'])) {
  84.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['graf_opc_atual']   = $_POST['opc_atual'];
  85.            }
  86.            if (isset($_POST['order'])) {
  87.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['graf_order']       = $_POST['order'];
  88.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_order']       = $_POST['order'];
  89.            }
  90.            if (isset($_POST['barra_orien'])) {
  91.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_barra_orien'] = $_POST['barra_orien'];
  92.            }
  93.            if (isset($_POST['barra_forma'])) {
  94.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_barra_forma'] = $_POST['barra_forma'];
  95.            }
  96.            if (isset($_POST['barra_dimen'])) {
  97.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_barra_dimen'] = $_POST['barra_dimen'];
  98.            }
  99.            if (isset($_POST['barra_sobre'])) {
  100.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_barra_sobre'] = $_POST['barra_sobre'];
  101.            }
  102.            if (isset($_POST['barra_empil'])) {
  103.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_barra_empil'] = $_POST['barra_empil'];
  104.            }
  105.            if (isset($_POST['barra_inver'])) {
  106.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_barra_inver'] = $_POST['barra_inver'];
  107.            }
  108.            if (isset($_POST['barra_agrup'])) {
  109.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_barra_agrup'] = $_POST['barra_agrup'];
  110.            }
  111.            if (isset($_POST['barra_funil'])) {
  112.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_barra_funil'] = $_POST['barra_funil'];
  113.            }
  114.            if (isset($_POST['pizza_forma'])) {
  115.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_pizza_forma'] = $_POST['pizza_forma'];
  116.            }
  117.            if (isset($_POST['pizza_dimen'])) {
  118.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_pizza_dimen'] = $_POST['pizza_dimen'];
  119.            }
  120.            if (isset($_POST['pizza_orden'])) {
  121.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_pizza_orden'] = $_POST['pizza_orden'];
  122.            }
  123.            if (isset($_POST['pizza_explo'])) {
  124.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_pizza_explo'] = $_POST['pizza_explo'];
  125.            }
  126.            if (isset($_POST['pizza_valor'])) {
  127.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_pizza_valor'] = $_POST['pizza_valor'];
  128.            }
  129.            if (isset($_POST['linha_forma'])) {
  130.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_linha_forma'] = $_POST['linha_forma'];
  131.            }
  132.            if (isset($_POST['linha_inver'])) {
  133.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_linha_inver'] = $_POST['linha_inver'];
  134.            }
  135.            if (isset($_POST['linha_agrup'])) {
  136.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_linha_agrup'] = $_POST['linha_agrup'];
  137.            }
  138.            if (isset($_POST['area_forma'])) {
  139.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_area_forma']  = $_POST['area_forma'];
  140.            }
  141.            if (isset($_POST['area_empil'])) {
  142.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_area_empil']  = $_POST['area_empil'];
  143.            }
  144.            if (isset($_POST['area_inver'])) {
  145.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_area_inver']  = $_POST['area_inver'];
  146.            }
  147.            if (isset($_POST['area_agrup'])) {
  148.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_area_agrup']  = $_POST['area_agrup'];
  149.            }
  150.            if (isset($_POST['marca_inver'])) {
  151.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_marca_inver'] = $_POST['marca_inver'];
  152.            }
  153.            if (isset($_POST['marca_agrup'])) {
  154.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_marca_agrup'] = $_POST['marca_agrup'];
  155.            }
  156.            if (isset($_POST['gauge_forma'])) {
  157.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_gauge_forma']  = $_POST['gauge_forma'];
  158.            }
  159.            if (isset($_POST['radar_forma'])) {
  160.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_radar_forma']  = $_POST['radar_forma'];
  161.            }
  162.            if (isset($_POST['radar_empil'])) {
  163.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_radar_empil']  = $_POST['radar_empil'];
  164.            }
  165.            if (isset($_POST['polar_forma'])) {
  166.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_polar_forma']  = $_POST['polar_forma'];
  167.            }
  168.            if (isset($_POST['funil_dimen'])) {
  169.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_funil_dimen']  = $_POST['funil_dimen'];
  170.            }
  171.            if (isset($_POST['funil_inver'])) {
  172.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_funil_inver']  = $_POST['funil_inver'];
  173.            }
  174.            if (isset($_POST['pyram_dimen'])) {
  175.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_pyram_dimen']  = $_POST['pyram_dimen'];
  176.            }
  177.            if (isset($_POST['pyram_valor'])) {
  178.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_pyram_valor']  = $_POST['pyram_valor'];
  179.            }
  180.            if (isset($_POST['pyram_forma'])) {
  181.                $_SESSION['sc_session'][$sc_page][$nome_apl] ['cfg_graf']['graf_pyram_forma']  = $_POST['pyram_forma'];
  182.            }
  183.        }
  184.        else
  185.        {
  186.            if (isset($_POST['tipo'])) {
  187.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_tipo']        = $_POST['tipo'];
  188.            }
  189.            if (isset($_POST['largura'])) {
  190.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_larg']        = $_POST['largura'];
  191.            }
  192.            if (isset($_POST['altura'])) {
  193.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_alt']         = $_POST['altura'];
  194.            }
  195.            if (isset($_POST['opc_atual'])) {
  196.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_opc_atual']   = $_POST['opc_atual'];
  197.            }
  198.            if (isset($_POST['order'])) {
  199.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_order']       = $_POST['order'];
  200.            }
  201.            if (isset($_POST['barra_orien'])) {
  202.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_orien'] = $_POST['barra_orien'];
  203.            }
  204.            if (isset($_POST['barra_forma'])) {
  205.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_forma'] = $_POST['barra_forma'];
  206.            }
  207.            if (isset($_POST['barra_dimen'])) {
  208.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_dimen'] = $_POST['barra_dimen'];
  209.            }
  210.            if (isset($_POST['barra_sobre'])) {
  211.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_sobre'] = $_POST['barra_sobre'];
  212.            }
  213.            if (isset($_POST['barra_empil'])) {
  214.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_empil'] = $_POST['barra_empil'];
  215.            }
  216.            if (isset($_POST['barra_inver'])) {
  217.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_inver'] = $_POST['barra_inver'];
  218.            }
  219.            if (isset($_POST['barra_agrup'])) {
  220.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_agrup'] = $_POST['barra_agrup'];
  221.            }
  222.            if (isset($_POST['barra_funil'])) {
  223.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_funil'] = $_POST['barra_funil'];
  224.            }
  225.            if (isset($_POST['pizza_forma'])) {
  226.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_forma'] = $_POST['pizza_forma'];
  227.            }
  228.            if (isset($_POST['pizza_dimen'])) {
  229.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_dimen'] = $_POST['pizza_dimen'];
  230.            }
  231.            if (isset($_POST['pizza_orden'])) {
  232.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_orden'] = $_POST['pizza_orden'];
  233.            }
  234.            if (isset($_POST['pizza_explo'])) {
  235.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_explo'] = $_POST['pizza_explo'];
  236.            }
  237.            if (isset($_POST['pizza_valor'])) {
  238.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_valor'] = $_POST['pizza_valor'];
  239.            }
  240.            if (isset($_POST['linha_forma'])) {
  241.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_linha_forma'] = $_POST['linha_forma'];
  242.            }
  243.            if (isset($_POST['linha_inver'])) {
  244.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_linha_inver'] = $_POST['linha_inver'];
  245.            }
  246.            if (isset($_POST['linha_agrup'])) {
  247.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_linha_agrup'] = $_POST['linha_agrup'];
  248.            }
  249.            if (isset($_POST['area_forma'])) {
  250.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_area_forma']  = $_POST['area_forma'];
  251.            }
  252.            if (isset($_POST['area_empil'])) {
  253.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_area_empil']  = $_POST['area_empil'];
  254.            }
  255.            if (isset($_POST['area_inver'])) {
  256.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_area_inver']  = $_POST['area_inver'];
  257.            }
  258.            if (isset($_POST['area_agrup'])) {
  259.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_area_agrup']  = $_POST['area_agrup'];
  260.            }
  261.            if (isset($_POST['marca_inver'])) {
  262.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_marca_inver'] = $_POST['marca_inver'];
  263.            }
  264.            if (isset($_POST['marca_agrup'])) {
  265.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_marca_agrup'] = $_POST['marca_agrup'];
  266.            }
  267.            if (isset($_POST['gauge_forma'])) {
  268.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_gauge_forma']  = $_POST['gauge_forma'];
  269.            }
  270.            if (isset($_POST['radar_forma'])) {
  271.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_radar_forma']  = $_POST['radar_forma'];
  272.            }
  273.            if (isset($_POST['radar_empil'])) {
  274.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_radar_empil']  = $_POST['radar_empil'];
  275.            }
  276.            if (isset($_POST['polar_forma'])) {
  277.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_polar_forma']  = $_POST['polar_forma'];
  278.            }
  279.            if (isset($_POST['funil_dimen'])) {
  280.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_funil_dimen']  = $_POST['funil_dimen'];
  281.            }
  282.            if (isset($_POST['funil_inver'])) {
  283.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_funil_inver']  = $_POST['funil_inver'];
  284.            }
  285.            if (isset($_POST['pyram_dimen'])) {
  286.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pyram_dimen']  = $_POST['pyram_dimen'];
  287.            }
  288.            if (isset($_POST['pyram_valor'])) {
  289.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pyram_valor']  = $_POST['pyram_valor'];
  290.            }
  291.            if (isset($_POST['pyram_forma'])) {
  292.                $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pyram_forma']  = $_POST['pyram_forma'];
  293.            }
  294.        }

  295.        if (isset($_POST['ajax']) && $_POST['ajax'] == "OK")
  296.        {
  297.            exit;
  298.        }

  299.     }

  300.     if (isset($_POST['bok_graf']) && $_POST['bok_graf'] == "OK")
  301.     {
  302. ?>
  303.        <html>
  304.        <body>
  305.        <script language="javascript">
  306.           var tp_apl = "<?php echo $tp_apl ?>";
  307.           if (tp_apl == "ger_gra")
  308.           {
  309.               self.parent.document.refresh_config.submit();
  310.           }
  311.           self.parent.tb_remove();
  312.        </script>
  313.        </body>
  314.        </html>
  315. <?php
  316.        exit;
  317.     }
  318.     elseif ($campo_apl == "nm_resumo_graf")
  319.     {
  320.         $disp        $_SESSION['sc_session'][$sc_page][$nome_apl] ['graf_disp'];
  321.         $tipo        $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_tipo'];
  322.         $mod_allowed $_SESSION['sc_session'][$sc_page][$nome_apl] ['graf_mod_allowed'];
  323.         $largura     $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_larg'];
  324.         $altura      $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_alt'];
  325.         $opc_atual   $_SESSION['sc_session'][$sc_page][$nome_apl] ['graf_opc_atual'];
  326.         $order       $_SESSION['sc_session'][$sc_page][$nome_apl] ['graf_order'];

  327.         $barra_orien $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_barra_orien'];
  328.         $barra_forma $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_barra_forma'];
  329.         $barra_dimen $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_barra_dimen'];
  330.         $barra_sobre $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_barra_sobre'];
  331.         $barra_empil $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_barra_empil'];
  332.         $barra_inver $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_barra_inver'];
  333.         $barra_agrup $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_barra_agrup'];
  334.         $barra_funil $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_barra_funil'];

  335.         $pizza_forma $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_pizza_forma'];
  336.         $pizza_dimen $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_pizza_dimen'];
  337.         $pizza_orden $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_pizza_orden'];
  338.         $pizza_explo $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_pizza_explo'];
  339.         $pizza_valor $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_pizza_valor'];

  340.         $linha_forma $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_linha_forma'];
  341.         $linha_inver $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_linha_inver'];
  342.         $linha_agrup $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_linha_agrup'];

  343.         $area_forma  $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_area_forma'];
  344.         $area_empil  $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_area_empil'];
  345.         $area_inver  $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_area_inver'];
  346.         $area_agrup  $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_area_agrup'];

  347.         $marca_inver $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_marca_inver'];
  348.         $marca_agrup $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_marca_agrup'];

  349.         $gauge_forma $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_gauge_forma'];

  350.         $radar_forma $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_radar_forma'];
  351.         $radar_empil $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_radar_empil'];

  352.         $polar_forma $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_polar_forma'];

  353.         $funil_dimen $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_funil_dimen'];
  354.         $funil_inver $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_funil_inver'];

  355.         $pyram_dimen $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_pyram_dimen'];
  356.         $pyram_valor $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_pyram_valor'];
  357.         $pyram_forma $_SESSION['sc_session'][$sc_page][$nome_apl]['cfg_graf'] ['graf_pyram_forma'];
  358.     }
  359.     else
  360.     {
  361.         $disp        $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_disp'];
  362.         $tipo        $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_tipo'];
  363.         $mod_allowed $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_mod_allowed'];
  364.         $largura     $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_larg'];
  365.         $altura      $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_alt'];
  366.         $opc_atual   $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_opc_atual'];
  367.         $order       $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_order'];

  368.         $barra_orien $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_orien'];
  369.         $barra_forma $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_forma'];
  370.         $barra_dimen $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_dimen'];
  371.         $barra_sobre $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_sobre'];
  372.         $barra_empil $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_empil'];
  373.         $barra_inver $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_inver'];
  374.         $barra_agrup $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_agrup'];
  375.         $barra_funil $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_barra_funil'];

  376.         $pizza_forma $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_forma'];
  377.         $pizza_dimen $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_dimen'];
  378.         $pizza_orden $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_orden'];
  379.         $pizza_explo $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_explo'];
  380.         $pizza_valor $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pizza_valor'];

  381.         $linha_forma $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_linha_forma'];
  382.         $linha_inver $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_linha_inver'];
  383.         $linha_agrup $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_linha_agrup'];

  384.         $area_forma  $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_area_forma'];
  385.         $area_empil  $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_area_empil'];
  386.         $area_inver  $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_area_inver'];
  387.         $area_agrup  $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_area_agrup'];

  388.         $marca_inver $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_marca_inver'];
  389.         $marca_agrup $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_marca_agrup'];

  390.         $gauge_forma $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_gauge_forma'];

  391.         $radar_forma $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_radar_forma'];
  392.         $radar_empil $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_radar_empil'];

  393.         $polar_forma $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_polar_forma'];

  394.         $funil_dimen $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_funil_dimen'];
  395.         $funil_inver $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_funil_inver'];

  396.         $pyram_dimen $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pyram_dimen'];
  397.         $pyram_valor $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pyram_valor'];
  398.         $pyram_forma $_SESSION['sc_session'][$sc_page][$nome_apl][$campo_apl] ['graf_pyram_forma'];
  399.     }

  400.     if (empty($largura))
  401.     {
  402.         $largura 512;
  403.     }
  404.     if (empty($altura))
  405.     {
  406.         $altura 384;
  407.     }

  408.     $tradutor = array();
  409.     if (isset($_SESSION['scriptcase']['sc_idioma_graf_flash']))
  410.     {
  411.         $tradutor $_SESSION['scriptcase']['sc_idioma_graf_flash'];
  412.     }
  413.     if (!isset($tradutor[$language]))
  414.     {
  415.         foreach ($tradutor as $language => $resto)
  416.         {
  417.             break;
  418.         }
  419.     }

  420.     //if (!in_array($tipo, array('Bar', 'Pie', 'Line', 'Area', 'Mark', 'Gauge', 'Radar', 'Polar', 'Funnel')))
  421.     if (!in_array($tipo, array('Bar''Pie''Line''Area''Gauge''Radar''Funnel''Pyramid')))
  422.     {
  423.         $tipo 'Bar';
  424.     }

  425.     $sStyleBarra    'display: none;';
  426.     $sStylePizza    'display: none;';
  427.     $sStyleLinha    'display: none;';
  428.     $sStyleArea     'display: none;';
  429.     $sStyleMarcador 'display: none;';
  430.     $sStyleGauge    'display: none;';
  431.     $sStyleRadar    'display: none;';
  432.     $sStylePolar    'display: none;';
  433.     $sStyleFunnel   'display: none;';
  434.     $sStylePyram    'display: none;';
  435.     switch ($tipo)
  436.     {
  437.         case 'Bar':
  438.             $sStyleBarra '';
  439.             break;
  440.         case 'Pie':
  441.             $sStylePizza '';
  442.             break;
  443.         case 'Line':
  444.             $sStyleLinha '';
  445.             break;
  446.         case 'Area':
  447.             $sStyleArea '';
  448.             break;
  449.         case 'Mark':
  450.             $sStyleMarcador '';
  451.             break;
  452.         case 'Gauge':
  453.             $sStyleGauge '';
  454.             break;
  455.         case 'Radar':
  456.             $sStyleRadar '';
  457.             break;
  458.         case 'Polar':
  459.             $sStylePolar '';
  460.             break;
  461.         case 'Funnel':
  462.             $sStyleFunnel '';
  463.             break;
  464.         case 'Pyramid':
  465.             $sStylePyram '';
  466.             break;
  467.     }

  468. ?>
  469. <html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  470. <head>
  471.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html']; ?>" />
  472. <?php
  473. if ($_SESSION['scriptcase']['proc_mobile'])
  474. {
  475. ?>
  476.  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  477. <?php
  478. }
  479. ?>
  480.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" />
  481.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" />
  482.  <?php
  483.   if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  484.   {
  485.     ?>
  486.     <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts']; ?>" />
  487.     <?php
  488.   }
  489.  ?>
  490.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" />
  491.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" />
  492.  </head>
  493. <body class="scGridPage" style="margin: 0px; overflow-x: hidden">

  494. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  495. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>

  496. <form name="config_graf" method="post">
  497. <?php
  498. $pos "left";
  499. if ($_SESSION['scriptcase']['reg_conf']['html_dir'] == " DIR='RTL'")
  500. {
  501.     $pos "right";
  502. }
  503. ?>
  504. <table id="main_table" class="exportConfig" style="position: relative; top: 20px; <?php echo $pos?>: 20px">
  505. <tr>
  506.  <td>
  507.   <div class="scGridBorder">
  508.   <table class="scGridTabela" width='100%' cellspacing=0 cellpadding=0>
  509.    <tr>
  510.     <td class="scGridLabelVert"><?php echo $tradutor[$language]['titulo']; ?></td>
  511.    </tr>

  512.  <tr><td class="scGridFieldOdd">
  513.   <table style="border-collapse: collapse; border-width: 0px">
  514.    <tr>
  515.     <td class="scGridFieldOddFont">
  516.      <b><?php echo $tradutor[$language]['tipo_g']; ?></b>
  517.      <br />
  518.      <select name="tipo" onChange="omite_lin()">
  519. <?php
  520. foreach ($disp as $graf_disp) {
  521.     if (in_array($graf_disp, array('Mark''Polar')))
  522.         {
  523.             continue;
  524.         }
  525.     switch ($graf_disp) {
  526.         case 'Bar':
  527.             $trad_graf 'tp_barra';
  528.             break;
  529.         case 'Pie':
  530.             $trad_graf 'tp_pizza';
  531.             break;
  532.         case 'Line':
  533.             $trad_graf 'tp_linha';
  534.             break;
  535.         case 'Area':
  536.             $trad_graf 'tp_area';
  537.             break;
  538.         case 'Mark':
  539.             $trad_graf 'tp_marcador';
  540.             break;
  541.         case 'Gauge':
  542.             $trad_graf 'tp_gauge';
  543.             break;
  544.         case 'Radar':
  545.             $trad_graf 'tp_radar';
  546.             break;
  547.         case 'Polar':
  548.             $trad_graf 'tp_polar';
  549.             break;
  550.         case 'Funnel':
  551.             $trad_graf 'tp_funil';
  552.             break;
  553.         case 'Pyramid':
  554.             $trad_graf 'tp_pyramid';
  555.             break;
  556.     }
  557. ?>
  558.       <option value="<?php echo $graf_disp?>"<?php if ($graf_disp  == $tipo) { echo ' selected'; } ?>><?php echo $tradutor[$language][$trad_graf]; ?></option>
  559. <?php
  560. }
  561. ?>
  562.      </select>
  563.     </td>
  564.     <td class="scGridFieldOddFont">
  565.      <b><?php echo $tradutor[$language]['modo_gera']; ?></b>
  566.      <br />
  567. <?php
  568.     if (isset($mod_allowed) && == sizeof($mod_allowed))
  569.     {
  570. ?>
  571.      <?php echo == $mod_allowed[0] ? $tradutor[$language]['analitico'] : $tradutor[$language]['sintetico']; ?>
  572.      <input type="hidden" name="opc_atual" value="<?php echo $mod_allowed[0]; ?>" />
  573. <?php
  574.     }
  575.     else
  576.     {
  577. ?>
  578.      <select  name="opc_atual"  size=1>
  579.        <option value="1" <?php if ($opc_atual == "1")  { echo " selected" ;} ?>><?php echo $tradutor[$language]['sintetico']; ?></option>
  580.        <option value="2" <?php if ($opc_atual == "2")  { echo " selected" ;} ?>><?php echo $tradutor[$language]['analitico']; ?></option>
  581.      </select>
  582. <?php
  583.     }
  584. ?>
  585.     </td>
  586.    </tr>
  587.    <tr>
  588.     <td class="scGridFieldOddFont">
  589.      <b><?php echo $tradutor[$language]['largura']; ?></b>
  590.      <br />
  591.      <input type="text" size="10" name="largura" value="<?php echo NM_encode_input($largura); ?>" />
  592.     </td>
  593.     <td class="scGridFieldOddFont">
  594.      <b><?php echo $tradutor[$language]['altura']; ?></b>
  595.      <br />
  596.      <input type="text" size="10" name="altura" value="<?php echo NM_encode_input($altura); ?>" />
  597.     </td>
  598.    </tr>
  599.    <tr>
  600.     <td class="scGridFieldOddFont" colspan="2">
  601.      <b><?php echo $tradutor[$language]['order']; ?></b>
  602.      <br />
  603.      <select  name="order"  size=1>
  604.        <option value="" <?php     if ($order == "")      { echo " selected" ;} ?>><?php echo $tradutor[$language]['order_none']; ?></option>
  605.        <option value="asc" <?php  if ($order == "asc")   { echo " selected" ;} ?>><?php echo $tradutor[$language]['order_asc'];  ?></option>
  606.        <option value="desc" <?php if ($order == "desc")  { echo " selected" ;} ?>><?php echo $tradutor[$language]['order_desc']; ?></option>
  607.      </select>
  608.     </td>
  609.    </tr>
  610.   </table>
  611.  </td></tr>
  612.  <tr>
  613.   <td class="scGridLabelVert">
  614.     <span id="group_title_Bar" style="<?php    echo $sStyleBarra;    ?>"><?php echo $tradutor[$language]['tp_barra'];    ?></span>
  615.     <span id="group_title_Pie" style="<?php    echo $sStylePizza;    ?>"><?php echo $tradutor[$language]['tp_pizza'];    ?></span>
  616.     <span id="group_title_Line" style="<?php   echo $sStyleLinha;    ?>"><?php echo $tradutor[$language]['tp_linha'];    ?></span>
  617.     <span id="group_title_Area" style="<?php   echo $sStyleArea;     ?>"><?php echo $tradutor[$language]['tp_area'];     ?></span>
  618.     <span id="group_title_Mark" style="<?php   echo $sStyleMarcador?>"><?php echo $tradutor[$language]['tp_marcador']; ?></span>
  619.     <span id="group_title_Gauge" style="<?php  echo $sStyleGauge;    ?>"><?php echo $tradutor[$language]['tp_gauge'];    ?></span>
  620.     <span id="group_title_Radar" style="<?php  echo $sStyleRadar;    ?>"><?php echo $tradutor[$language]['tp_radar'];    ?></span>
  621.     <span id="group_title_Polar" style="<?php  echo $sStylePolar;    ?>"><?php echo $tradutor[$language]['tp_polar'];    ?></span>
  622.     <span id="group_title_Funnel" style="<?php echo $sStyleFunnel;   ?>"><?php echo $tradutor[$language]['tp_funil'];    ?></span>
  623.     <span id="group_title_Pyram" style="<?php  echo $sStylePyram;    ?>"><?php echo $tradutor[$language]['tp_pyramid'];  ?></span>
  624.   </td>
  625.  </tr>
  626.  <tr><td class="scGridFieldOdd">

  627.   <table id="group_data_Bar" style="<?php echo $sStyleBarra?>border-collapse: collapse; border-width: 0px">
  628.    <tr>
  629.     <td class="scGridFieldOddFont">
  630.      <b><?php echo $tradutor[$language]['barra_orien']; ?></b>
  631.      <br />
  632.      <select name="barra_orien">
  633.       <option value="Horizontal"<?php if ('Horizontal' == $barra_orien) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_orien_horiz']; ?></option>
  634.       <option value="Vertical"<?php   if ('Vertical'   == $barra_orien) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_orien_verti']; ?></option>
  635.      </select>
  636.     </td>
  637.     <td class="scGridFieldOddFont">
  638.      <b><?php echo $tradutor[$language]['barra_dimen']; ?></b>
  639.      <br />
  640.      <select name="barra_dimen">
  641.       <option value="2d"<?php if ('2d' == $barra_dimen) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_dimen_2d']; ?></option>
  642.       <option value="3d"<?php if ('3d' == $barra_dimen) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_dimen_3d']; ?></option>
  643.      </select>
  644.     </td>
  645.    </tr>
  646.    <tr>
  647.     <td class="scGridFieldOddFont">
  648.      <b><?php echo $tradutor[$language]['barra_empil']; ?></b>
  649.      <br />
  650.      <select name="barra_empil">
  651.       <option value="Off"<?php     if ('Off'     == $barra_empil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_empil_desat']; ?></option>
  652.       <option value="On"<?php      if ('On'      == $barra_empil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_empil_ativa']; ?></option>
  653.       <option value="Percent"<?php if ('Percent' == $barra_empil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_empil_perce']; ?></option>
  654.      </select>
  655.     </td>
  656.     <td class="scGridFieldOddFont">
  657.      <b><?php echo $tradutor[$language]['barra_sobre']; ?></b>
  658.      <br />
  659.      <select name="barra_sobre">
  660.       <option value="No"<?php  if ('No'  == $barra_sobre) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_sobre_nao']; ?></option>
  661.       <option value="Yes"<?php if ('Yes' == $barra_sobre) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_sobre_sim']; ?></option>
  662.      </select>
  663.     </td>
  664.    </tr>
  665.    <tr style="display: none">
  666.     <td class="scGridFieldOddFont">
  667.      <b><?php echo $tradutor[$language]['barra_inver']; ?></b>
  668.      <br />
  669.      <select name="barra_inver">
  670.       <option value="Normal"<?php   if ('Normal'   == $barra_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_sobre_nao']; ?></option>
  671.       <option value="Reversed"<?php if ('Reversed' == $barra_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_sobre_sim']; ?></option>
  672.      </select>
  673.     </td>
  674.     <td class="scGridFieldOddFont">
  675.      <b><?php echo $tradutor[$language]['barra_agrup']; ?></b>
  676.      <br />
  677.      <select name="barra_agrup">
  678.       <option value="Normal"<?php if ('Normal' == $barra_agrup) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_agrup_conju']; ?></option>
  679.       <option value="Series"<?php if ('Series' == $barra_agrup) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_agrup_serie']; ?></option>
  680.      </select>
  681.     </td>
  682.    </tr>
  683.    <tr style="display: none">
  684.     <td class="scGridFieldOddFont" style="display: none">
  685.      <b><?php echo $tradutor[$language]['barra_forma']; ?></b>
  686.      <br />
  687.      <select name="barra_forma">
  688.       <option value="Bar"<?php      if ('Bar'      == $barra_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_forma_barra']; ?></option>
  689.       <option value="Cylinder"<?php if ('Cylinder' == $barra_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_forma_cilin']; ?></option>
  690.       <option value="Cone"<?php     if ('Cone'     == $barra_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_forma_cone']; ?></option>
  691.       <option value="Pyramid"<?php  if ('Pyramid'  == $barra_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_forma_piram']; ?></option>
  692.      </select>
  693.     </td>
  694.     <td class="scGridFieldOddFont" style="display: none">
  695.      <b><?php echo $tradutor[$language]['barra_funil']; ?></b>
  696.      <br />
  697.      <select name="barra_funil">
  698.       <option value="N"<?php if ('N' == $barra_funil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_sobre_nao']; ?></option>
  699.       <option value="Y"<?php if ('Y' == $barra_funil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_sobre_sim']; ?></option>
  700.      </select>
  701.     </td>
  702.    </tr>
  703.   </table>

  704.   <table id="group_data_Pie" style="<?php echo $sStylePizza?>border-collapse: collapse; border-width: 0px">
  705.    <tr>
  706.     <td class="scGridFieldOddFont">
  707.      <b><?php echo $tradutor[$language]['pizza_forma']; ?></b>
  708.      <br />
  709.      <select name="pizza_forma">
  710.       <option value="Pie"<?php   if ('Pie'   == $pizza_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_forma_pizza']; ?></option>
  711.       <option value="Donut"<?php if ('Donut' == $pizza_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_forma_donut']; ?></option>
  712.      </select>
  713.     </td>
  714.     <td class="scGridFieldOddFont">
  715.      <b><?php echo $tradutor[$language]['pizza_dimen']; ?></b>
  716.      <br />
  717.      <select name="pizza_dimen">
  718.       <option value="2d"<?php if ('2d' == $pizza_dimen) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_dimen_2d']; ?></option>
  719.       <option value="3d"<?php if ('3d' == $pizza_dimen) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_dimen_3d']; ?></option>
  720.      </select>
  721.     </td>
  722.    </tr>
  723.    <tr>
  724.     <td class="scGridFieldOddFont">
  725.      <b><?php echo $tradutor[$language]['pizza_orden']; ?></b>
  726.      <br />
  727.      <select name="pizza_orden">
  728.       <option value="Off"<?php  if ('Off'  == $pizza_orden) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_orden_desat']; ?></option>
  729.       <option value="Asc"<?php  if ('Asc'  == $pizza_orden) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_orden_ascen']; ?></option>
  730.       <option value="Desc"<?php if ('Desc' == $pizza_orden) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_orden_desce']; ?></option>
  731.      </select>
  732.     </td>
  733.     <td class="scGridFieldOddFont">
  734.      <b><?php echo $tradutor[$language]['pizza_valor']; ?></b>
  735.      <br />
  736.      <select name="pizza_valor">
  737.       <option value="Valor"<?php   if ('Valor'   == $pizza_valor) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_valor_valor']; ?></option>
  738.       <option value="Percent"<?php if ('Percent' == $pizza_valor) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_valor_perce']; ?></option>
  739.      </select>
  740.     </td>
  741.    </tr>
  742.    <tr>
  743.     <td class="scGridFieldOddFont" style="display: none">
  744.      <b><?php echo $tradutor[$language]['pizza_explo']; ?></b>
  745.      <br />
  746.      <select name="pizza_explo">
  747.       <option value="Off"<?php   if ('Off'   == $pizza_explo) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_explo_desat']; ?></option>
  748.       <option value="On"<?php    if ('On'    == $pizza_explo) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_explo_ativa']; ?></option>
  749.       <option value="Click"<?php if ('Click' == $pizza_explo) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_explo_click']; ?></option>
  750.      </select>
  751.     </td>
  752.    </tr>
  753.   </table>

  754.   <table id="group_data_Line" style="<?php echo $sStyleLinha?>border-collapse: collapse; border-width: 0px">
  755.    <tr>
  756.     <td class="scGridFieldOddFont">
  757.      <b><?php echo $tradutor[$language]['linha_forma']; ?></b>
  758.      <br />
  759.      <select name="linha_forma">
  760.       <option value="Line"<?php   if ('Line'   == $linha_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['linha_forma_linha']; ?></option>
  761.       <option value="Spline"<?php if ('Spline' == $linha_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['linha_forma_splin']; ?></option>
  762.       <option value="Step"<?php   if ('Step'   == $linha_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['linha_forma_degra']; ?></option>
  763.      </select>
  764.     </td>
  765.     <td class="scGridFieldOddFont" colspan="2">
  766.      <b><?php echo $tradutor[$language]['linha_agrup']; ?></b>
  767.      <br />
  768.      <select name="linha_agrup">
  769.       <option value="Normal"<?php if ('Normal' == $linha_agrup) { echo ' selected'; } ?>><?php echo $tradutor[$language]['linha_agrup_conju']; ?></option>
  770.       <option value="Series"<?php if ('Series' == $linha_agrup) { echo ' selected'; } ?>><?php echo $tradutor[$language]['linha_agrup_serie']; ?></option>
  771.      </select>
  772.     </td>
  773.    </tr>
  774.    <tr style="display: none">
  775.     <td class="scGridFieldOddFont">
  776.      <b><?php echo $tradutor[$language]['linha_inver']; ?></b>
  777.      <br />
  778.      <select name="linha_inver">
  779.       <option value="Normal"<?php   if ('Normal'   == $linha_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['linha_inver_norma']; ?></option>
  780.       <option value="Reversed"<?php if ('Reversed' == $linha_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['linha_inver_inver']; ?></option>
  781.      </select>
  782.     </td>
  783.    </tr>
  784.   </table>

  785.   <table id="group_data_Area" style="<?php echo $sStyleArea?>border-collapse: collapse; border-width: 0px">
  786.    <tr>
  787.     <td class="scGridFieldOddFont">
  788.      <b><?php echo $tradutor[$language]['area_forma']; ?></b>
  789.      <br />
  790.      <select name="area_forma">
  791.       <option value="Area"<?php   if ('Area'   == $area_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_forma_area']; ?></option>
  792.       <option value="Spline"<?php if ('Spline' == $area_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_forma_splin']; ?></option>
  793.      </select>
  794.     </td>
  795.     <td class="scGridFieldOddFont">
  796.      <b><?php echo $tradutor[$language]['area_empil']; ?></b>
  797.      <br />
  798.      <select name="area_empil">
  799.       <option value="Off"<?php     if ('Off'     == $area_empil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_empil_desat']; ?></option>
  800.       <option value="On"<?php      if ('On'      == $area_empil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_empil_ativa']; ?></option>
  801.       <option value="Percent"<?php if ('Percent' == $area_empil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_empil_perce']; ?></option>
  802.      </select>
  803.     </td>
  804.    </tr>
  805.    <tr>
  806.     <td class="scGridFieldOddFont">
  807.      <b><?php echo $tradutor[$language]['area_agrup']; ?></b>
  808.      <br />
  809.      <select name="area_agrup">
  810.       <option value="Normal"<?php if ('Normal' == $area_agrup) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_agrup_conju']; ?></option>
  811.       <option value="Series"<?php if ('Series' == $area_agrup) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_agrup_serie']; ?></option>
  812.      </select>
  813.     </td>
  814.     <td class="scGridFieldOddFont" style="display: none">
  815.      <b><?php echo $tradutor[$language]['area_inver']; ?></b>
  816.      <br />
  817.      <select name="area_inver">
  818.       <option value="Normal"<?php   if ('Normal'   == $area_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_inver_norma']; ?></option>
  819.       <option value="Reversed"<?php if ('Reversed' == $area_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_inver_inver']; ?></option>
  820.      </select>
  821.     </td>
  822.    </tr>
  823.   </table>

  824.   <table id="group_data_Mark" style="<?php echo $sStyleMarcador?>border-collapse: collapse; border-width: 0px">
  825.    <tr>
  826.     <td class="scGridFieldOddFont">
  827.      <b><?php echo $tradutor[$language]['marca_inver']; ?></b>
  828.      <br />
  829.      <select name="marca_inver">
  830.       <option value="Normal"<?php   if ('Normal'   == $marca_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['marca_inver_norma']; ?></option>
  831.       <option value="Reversed"<?php if ('Reversed' == $marca_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['marca_inver_inver']; ?></option>
  832.      </select>
  833.     </td>
  834.     <td class="scGridFieldOddFont">
  835.      <b><?php echo $tradutor[$language]['marca_agrup']; ?></b>
  836.      <br />
  837.      <select name="marca_agrup">
  838.       <option value="Normal"<?php if ('Normal' == $marca_agrup) { echo ' selected'; } ?>><?php echo $tradutor[$language]['marca_agrup_conju']; ?></option>
  839.       <option value="Series"<?php if ('Series' == $marca_agrup) { echo ' selected'; } ?>><?php echo $tradutor[$language]['marca_agrup_serie']; ?></option>
  840.      </select>
  841.     </td>
  842.    </tr>
  843.   </table>

  844.   <table id="group_data_Gauge" style="<?php echo $sStyleGauge?>border-collapse: collapse; border-width: 0px">
  845.    <tr>
  846.     <td class="scGridFieldOddFont">
  847.      <b><?php echo $tradutor[$language]['gauge_forma']; ?></b>
  848.      <br />
  849.      <select name="gauge_forma">
  850.       <option value="Circular"<?php if ('Circular' == $gauge_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['gauge_forma_circular']; ?></option>
  851.       <option value="Semi"<?php     if ('Semi'     == $gauge_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['gauge_forma_semi'];     ?></option>
  852.      </select>
  853.     </td>
  854.    </tr>
  855.   </table>

  856.   <table id="group_data_Radar" style="<?php echo $sStyleRadar?>border-collapse: collapse; border-width: 0px">
  857.    <tr style="display: none">
  858.     <td class="scGridFieldOddFont">
  859.      <b><?php echo $tradutor[$language]['gauge_forma']; ?></b>
  860.      <br />
  861.      <select name="radar_forma">
  862.       <option value="Line"<?php if ('Line' == $radar_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['linha_forma_linha']; ?></option>
  863.       <option value="Area"<?php if ('Area' == $radar_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_forma_area'];   ?></option>
  864.      </select>
  865.     </td>
  866.     <td class="scGridFieldOddFont">
  867.      <b><?php echo $tradutor[$language]['area_empil']; ?></b>
  868.      <br />
  869.      <select name="radar_empil">
  870.       <option value="Off"<?php     if ('Off'     == $radar_empil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_empil_desat']; ?></option>
  871.       <option value="On"<?php      if ('On'      == $radar_empil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_empil_ativa']; ?></option>
  872.       <option value="Percent"<?php if ('Percent' == $radar_empil) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_empil_perce']; ?></option>
  873.      </select>
  874.     </td>
  875.    </tr>
  876.   </table>

  877.   <table id="group_data_Polar" style="<?php echo $sStylePolar?>border-collapse: collapse; border-width: 0px">
  878.    <tr>
  879.     <td class="scGridFieldOddFont">
  880.      <b><?php echo $tradutor[$language]['gauge_forma']; ?></b>
  881.      <br />
  882.      <select name="polar_forma">
  883.       <option value="Line"<?php if ('Line' == $polar_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['linha_forma_linha']; ?></option>
  884.       <option value="Area"<?php if ('Area' == $polar_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['area_forma_area'];   ?></option>
  885.      </select>
  886.     </td>
  887.    </tr>
  888.   </table>

  889.   <table id="group_data_Funnel" style="<?php echo $sStyleFunnel?>border-collapse: collapse; border-width: 0px">
  890.    <tr>
  891.     <td class="scGridFieldOddFont">
  892.      <b><?php echo $tradutor[$language]['barra_dimen']; ?></b>
  893.      <br />
  894.      <select name="funil_dimen">
  895.       <option value="2d"<?php if ('2d' == $funil_dimen) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_dimen_2d']; ?></option>
  896.       <option value="3d"<?php if ('3d' == $funil_dimen) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_dimen_3d']; ?></option>
  897.      </select>
  898.     </td>
  899.     <td class="scGridFieldOddFont" style="display: none">
  900.      <b><?php echo $tradutor[$language]['barra_inver']; ?></b>
  901.      <br />
  902.      <select name="funil_inver">
  903.       <option value="Normal"<?php   if ('Normal'   == $funil_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_sobre_nao']; ?></option>
  904.       <option value="Reversed"<?php if ('Reversed' == $funil_inver) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_sobre_sim']; ?></option>
  905.      </select>
  906.     </td>
  907.    </tr>
  908.   </table>

  909.   <table id="group_data_Pyramid" style="<?php echo $sStylePyram?>border-collapse: collapse; border-width: 0px">
  910.    <tr>
  911.     <td class="scGridFieldOddFont">
  912.      <b><?php echo $tradutor[$language]['barra_dimen']; ?></b>
  913.      <br />
  914.      <select name="pyram_dimen">
  915.       <option value="2d"<?php if ('2d' == $pyram_dimen) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_dimen_2d']; ?></option>
  916.       <option value="3d"<?php if ('3d' == $pyram_dimen) { echo ' selected'; } ?>><?php echo $tradutor[$language]['barra_dimen_3d']; ?></option>
  917.      </select>
  918.     </td>
  919.     <td class="scGridFieldOddFont">
  920.      <b><?php echo $tradutor[$language]['pizza_valor']; ?></b>
  921.      <br />
  922.      <select name="pyram_valor">
  923.       <option value="Valor"<?php   if ('Valor'   == $pyram_valor) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_valor_valor']; ?></option>
  924.       <option value="Percent"<?php if ('Percent' == $pyram_valor) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pizza_valor_perce']; ?></option>
  925.      </select>
  926.     </td>
  927.    </tr>
  928.    <tr>
  929.     <td class="scGridFieldOddFont" colspan="2">
  930.      <b><?php echo $tradutor[$language]['pyram_slice']; ?></b>
  931.      <br />
  932.      <select name="pyram_forma">
  933.       <option value="S"<?php if ('S' == $pyram_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pyram_slice_s']; ?></option>
  934.       <option value="N"<?php if ('N' == $pyram_forma) { echo ' selected'; } ?>><?php echo $tradutor[$language]['pyram_slice_n']; ?></option>
  935.      </select>
  936.     </td>
  937.    </tr>
  938.   </table>

  939.  </td></tr>
  940.  <tr>
  941.   <td class="scGridToolbar" style="text-align: center">
  942.    <?php echo $_SESSION['scriptcase']['bg_btn_popup']['bok']; ?>
  943.    &nbsp; &nbsp; &nbsp;
  944.    <?php echo $_SESSION['scriptcase']['bg_btn_popup']['btbremove']; ?>
  945.   </td>
  946.  </tr>
  947. </table>
  948.  </div>
  949.  </td>
  950.  </tr>
  951. </table>

  952.   <input type="hidden" name="nome_apl"  value="<?php echo NM_encode_input($nome_apl); ?>">
  953.   <input type="hidden" name="campo_apl" value="<?php echo NM_encode_input($campo_apl); ?>" >
  954.   <input type="hidden" name="sc_page"   value="<?php echo NM_encode_input($sc_page); ?>" >
  955.   <input type="hidden" name="bok_graf"  value="" >
  956. </form>
  957. <script language="javascript">
  958. var chart_type = '<?php echo $tipo?>';
  959. function omite_lin() {
  960.  var ind = document.config_graf.tipo.selectedIndex,
  961.      val = document.config_graf.tipo.options[ind].value,
  962.      mt  = document.getElementById('main_table');
  963.  if (val != chart_type) {
  964.   $('#group_title_' + chart_type).hide();
  965.   $('#group_data_' + chart_type).hide();
  966.   chart_type = val;
  967.   $('#group_title_' + chart_type).show();
  968.   $('#group_data_' + chart_type).show();
  969.  }
  970.  var W = mt.clientWidth,
  971.      H = mt.clientHeight;
  972.  if (0 == W || 0 == H) {
  973.   setTimeout("omite_lin()", 50);
  974.  }
  975.  else {
  976.   self.parent.tb_resize(H + 40, W + 40);
  977.  }
  978. }
  979. function processa() {
  980.  document.config_graf.bok_graf.value = "OK";
  981.  document.config_graf.submit();

  982.  $('#bsair').click();
  983. }
  984. </script>
  985. <script>
  986. $(function() {
  987.  setTimeout("omite_lin()", 50);
  988. });
  989. </script>
  990. </body>
  991. </html>
Return
grid_new_config_pdf.php
  1. <?php
  2. /**
  3.  * $Id: nm_gp_config_pdf.php,v 1.6 2012-01-31 19:33:19 luis Exp $
  4.  */
  5.     include_once('grid_new_session.php');
  6.     session_start();
  7.     $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  8.     //check tmp
  9.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  10.     {
  11.         $str_path_apl_url $_SERVER['PHP_SELF'];
  12.         $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  13.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  14.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  15.         /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  16.     }
  17.     $SC_cod_proj "Projeto7";
  18.     $SC_apl_proc "grid_new";
  19.     $SC_ver_93   true;
  20.     $SC_conf_opt explode(",","tem_res_cons,tem_res_res,cor_imp,papel,orientacao,bookmarks,all_cab,all_label,label_group,page_break");
  21. /* sc_apl_default */
  22.     if (!isset($_SESSION['sc_session']))
  23.     {
  24.         $NM_dir_atual getcwd();
  25.         if (empty($NM_dir_atual))
  26.         {
  27.             $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  28.             $str_path_sys  str_replace("\\"'/'$str_path_sys);
  29.         }
  30.         else
  31.         {
  32.             $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  33.             $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  34.         }
  35.         $str_path_web    $_SERVER['PHP_SELF'];
  36.         $str_path_web    str_replace("\\"'/'$str_path_web);
  37.         $str_path_web    str_replace('//''/'$str_path_web);
  38.         $root            substr($str_path_sys0, -strlen($str_path_web));
  39.         if (is_file($root $_SESSION['scriptcase'][$SC_apl_proc]['glo_nm_path_imag_temp'] . "/sc_apl_default_" $SC_cod_proj ".txt"))
  40.         {
  41. ?>
  42.             <script language="javascript">
  43.                parent.nm_move();
  44.             </script>
  45. <?php
  46.             exit;
  47.         }
  48.     }
  49.     $fonte        = (isset($_GET['conf_fonte']))    ? filter_input(INPUT_GET'conf_fonte'FILTER_SANITIZE_STRING) : "0";
  50.     $grafico      = (isset($_GET['grafico']))       ? filter_input(INPUT_GET'grafico'FILTER_SANITIZE_STRING) : "";
  51.     $largura      = (isset($_GET['largura']))       ? filter_input(INPUT_GET'largura'FILTER_SANITIZE_STRING) : "";
  52.     $opc          = (isset($_GET['nm_opc']))        ? filter_input(INPUT_GET'nm_opc'FILTER_SANITIZE_STRING) : "";
  53.     $target       = (isset($_GET['nm_target']))     ? filter_input(INPUT_GET'nm_target'FILTER_SANITIZE_STRING) : "";
  54.     $language     = (isset($_GET['language']))      ? filter_input(INPUT_GET'language'FILTER_SANITIZE_STRING) : "en_us";
  55.     $papel        = (isset($_GET['papel']))         ? filter_input(INPUT_GET'papel'FILTER_SANITIZE_STRING) : "";
  56.     $cor          = (isset($_GET['nm_cor']))        ? filter_input(INPUT_GET'nm_cor'FILTER_SANITIZE_STRING) : "";
  57.     $orientacao   = (isset($_GET['orientacao']))    ? filter_input(INPUT_GET'orientacao'FILTER_SANITIZE_STRING) : "";
  58.     $conf_larg    = (isset($_GET['conf_larg']))     ? filter_input(INPUT_GET'conf_larg'FILTER_SANITIZE_STRING) : "N";
  59.     $conf_socor   = (isset($_GET['conf_socor']))    ? filter_input(INPUT_GET'conf_socor'FILTER_SANITIZE_STRING) : "N";
  60.     $apapel       = (isset($_GET['apapel']))        ? filter_input(INPUT_GET'apapel'FILTER_SANITIZE_STRING) : "";
  61.     $lpapel       = (isset($_GET['lpapel']))        ? filter_input(INPUT_GET'lpapel'FILTER_SANITIZE_STRING) : "";
  62.     $is_chart_app = (isset($_GET['is_chart_app']))  ? 'Y' == filter_input(INPUT_GET'is_chart_app'FILTER_SANITIZE_STRING) : false;
  63.     $createCharts = (isset($_GET['create_charts'])) ? filter_input(INPUT_GET'create_charts'FILTER_SANITIZE_STRING) : 'S';
  64.     $app_name     = (isset($_GET['app_name']))      ? filter_input(INPUT_GET'app_name'FILTER_SANITIZE_STRING) : 'N';
  65.     $password     = (isset($_GET['password']))       ? $_GET['password'] : "s";
  66.     $res_cons     = (isset($_GET['nm_res_cons']))    ? $_GET['nm_res_cons']    : "n";
  67.     $tem_gb_pdf   = (isset($_GET['nm_tem_gb']))      ? $_GET['nm_tem_gb']      : "s";
  68.     $origem       = (isset($_GET['origem']))         ? $_GET['origem']         : "cons";
  69.     $ini_pdf_res  = (isset($_GET['nm_ini_pdf_res'])) ? explode(","$_GET['nm_ini_pdf_res']) : array();
  70.     $all_modules  = (isset($_GET['nm_all_modules'])) ? explode(","$_GET['nm_all_modules']) : array();
  71.     $ver_93       = (isset($_GET['sc_ver_93']))      ? $_GET['sc_ver_93']      : "n";

  72.     $bookmarks    = (isset($_GET['bookmarks'])) ?    $_GET['bookmarks'] : "S";
  73.     $label_group  = (isset($_GET['nm_label_group'])) ? $_GET['nm_label_group'] : "S";
  74.     $all_cab      = (isset($_GET['nm_all_cab']))     ? $_GET['nm_all_cab'] : "N";
  75.     $all_label    = (isset($_GET['nm_all_label']))   ? $_GET['nm_all_label'] : "N";
  76.     $pdf_zip      = (isset($_GET['pdf_zip']) && $ver_93 == "s") ? $_GET['pdf_zip'] : "N";
  77.     $orient_grid  = (isset($_GET['nm_orient_grid'])) ? $_GET['nm_orient_grid'] : "2";

  78.     $script_case_init = (isset($_GET['script_case_init'])) ? filter_input(INPUT_GET'script_case_init'FILTER_SANITIZE_NUMBER_INT) : 'N';
  79. /*--- exportacoes ajax */
  80.     $export_ajax = (isset($_GET['export_ajax'])) ? filter_input(INPUT_GET'export_ajax'FILTER_SANITIZE_STRING) : 'N';
  81.     $hasSelColumns= (isset($_GET['summary_export_columns']))  ? 'S' == filter_input(INPUT_GET'summary_export_columns'FILTER_SANITIZE_STRING) : false;
  82.     if (isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order']) && $opc != 'pdf_det') {
  83.         foreach ($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'] as $ind => $cada_cmp) {
  84.             if (!isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['labels'][$cada_cmp])) {
  85.                $hasSelColumns false;
  86.             }
  87.         }
  88.     }
  89.     else {
  90.          $hasSelColumns false;
  91.     }
  92. /*
  93.     if (!in_array("campos_sel", $SC_conf_opt)) {
  94.         $hasSelColumns = false;
  95.     }
  96. */
  97. /*--------*/

  98.     ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  99.     if (!function_exists("NM_is_utf8"))  {
  100.         include_once("../_lib/lib/php/nm_utf8.php");
  101.     }

  102.     $tradutor = array();
  103.     if (isset($_SESSION['scriptcase']['sc_idioma_pdf'])) {
  104.         $tradutor $_SESSION['scriptcase']['sc_idioma_pdf'];
  105.     }
  106.     if (!isset($tradutor[$language])) {
  107.          foreach ($tradutor as $language => $resto) {
  108.              break;
  109.          }
  110.     }
  111.     if (!isset($tradutor[$language])) {
  112.          exit;
  113.     }
  114.     $tp_papel = array();
  115.     if (!isset($_SESSION['scriptcase']['sc_tp_pdf']) || $_SESSION['scriptcase']['sc_tp_pdf'] == "pd4ml") {
  116.         $tp_papel[1]  = "LETTER";
  117.         $tp_papel[2]  = "LEGAL";
  118.         $tp_papel[3]  = "LEDGER";
  119.         $tp_papel[4]  = "A0";
  120.         $tp_papel[5]  = "A1";
  121.         $tp_papel[6]  = "A2";
  122.         $tp_papel[7]  = "A3";
  123.         $tp_papel[8]  = "A4";
  124.         $tp_papel[9]  = "A5";
  125.         $tp_papel[10] = "A6";
  126.         $tp_papel[11] = "ISOB5";
  127.         $tp_papel[12] = "TABLOID";
  128.         $tp_papel[13] = "TABLOID ";
  129.         $tp_papel[14] = "A4";
  130.         $tp_papel[15] = "A4";
  131.         $tp_papel[16] = "A7";
  132.         $tp_papel[17] = "A8";
  133.         $tp_papel[18] = "A9";
  134.         $tp_papel[19] = "A10";
  135.         $tp_papel[20] = "ISOB0";
  136.         $tp_papel[21] = "ISOB1";
  137.         $tp_papel[22] = "ISOB2";
  138.         $tp_papel[23] = "ISOB3";
  139.         $tp_papel[24] = "ISOB4";
  140.         $tp_papel[25] = "NOTE";
  141.         $tp_papel[26] = "HALFLETTER";
  142.     }
  143.     else  {
  144.         $tp_papel[1]  = "Letter";
  145.         $tp_papel[2]  = "Legal";
  146.         $tp_papel[3]  = "Ledger";
  147.         $tp_papel[4]  = "A0";
  148.         $tp_papel[5]  = "A1";
  149.         $tp_papel[6]  = "A2";
  150.         $tp_papel[7]  = "A3";
  151.         $tp_papel[8]  = "A4";
  152.         $tp_papel[9]  = "A5";
  153.         $tp_papel[10] = "A6";
  154.         $tp_papel[11] = "B5";
  155.         $tp_papel[12] = "Tabloid";
  156.         $tp_papel[13] = "Tabloid ";
  157.         $tp_papel[14] = "A4";
  158.         $tp_papel[15] = "A4";
  159.         $tp_papel[16] = "A7";
  160.         $tp_papel[17] = "A8";
  161.         $tp_papel[18] = "A9";
  162.         $tp_papel[19] = "A9";
  163.         $tp_papel[20] = "B0";
  164.         $tp_papel[21] = "B1";
  165.         $tp_papel[22] = "B2";
  166.         $tp_papel[23] = "B3";
  167.         $tp_papel[24] = "B4";
  168.         $tp_papel[25] = "Executive";
  169.         $tp_papel[26] = "A5";
  170.         $tp_papel[27] = "B6";
  171.         $tp_papel[28] = "B7";
  172.         $tp_papel[29] = "B8";
  173.         $tp_papel[30] = "B9";
  174.         $tp_papel[31] = "B10";
  175.         $tp_papel[32] = "C5E";
  176.         $tp_papel[33] = "Comm10E";
  177.         $tp_papel[34] = "DLE";
  178.         $tp_papel[35] = "Folio";
  179.     }

  180.     if (!isset($tp_papel[$papel])) {
  181.         $papel 8;
  182.     }
  183.     if (!isset($tp_papel[$apapel])) {
  184.         $apapel 8;
  185.     }

  186. ?>
  187. <html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  188. <head>
  189.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html']; ?>" />
  190. <?php
  191. if ((isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])  || (isset($_SESSION['scriptcase']['device_mobile']) && $_SESSION['scriptcase']['device_mobile'] && $_SESSION['scriptcase']['display_mobile']))
  192. {
  193. ?>
  194.  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  195. <?php
  196. }
  197. ?>
  198.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" />
  199.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" />
  200.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab'?>" />
  201.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab_dir'?>" />
  202.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div'?>" />
  203.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div_dir'?>" />
  204.  <?php
  205.   if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  206.   {
  207.     ?>
  208.     <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts']; ?>" />
  209.     <?php
  210.   }
  211.  ?>
  212.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" />
  213.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/css/smoothness/jquery-ui.css" />
  214.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" />
  215.  </head>
  216. <body class="scGridPage" style="margin: 0px; overflow-x: hidden">

  217. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  218. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery-ui.js"></script>
  219. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>

  220. <form name="config_pdf" method="post">
  221. <?php
  222. $pos "left";
  223. if ($_SESSION['scriptcase']['reg_conf']['html_dir'] == " DIR='RTL'")
  224. {
  225.     $pos "right";
  226. }
  227. $top = ($opc != 'pdf_det') ? ' top: 20px;' '';
  228. ?>
  229. <table id="main_table" class="exportConfig" style="position: relative; <?php echo $top?> <?php echo $pos?>: 20px">
  230. <tr>
  231.  <td align="center">

  232.   <div id="tabs">
  233.     <ul class="scAppDivTabLine" style="display:<?php echo ($hasSelColumns)?"":"none"?>">
  234.       <li class="scTabActive"><a href="#tabs-general"><?php echo $tradutor[$language]['titulo']; ?></a></li>
  235.       <li class="scTabInactive"><a href="#tabs-sel-columns"><?php echo $tradutor[$language]['titulo_colunas']; ?></a></li>
  236.     </ul>
  237.     <div id="tabs-general" style="padding: 0px; margin: 0px">


  238.         <table class="scGridBorder" width='100%' cellspacing="0" cellpadding="0">
  239.           <tr style="display:<?php echo ($hasSelColumns)?"none":""?>">
  240.             <td colspan=2 class="scGridLabelVert"><?php echo $tradutor[$language]['titulo']; ?></td>
  241.           </tr>
  242.         <?php
  243.         $ckeck_grid  = (in_array("grid"$ini_pdf_res)) ? true false;
  244.         if ($res_cons == "s" && $origem != "chart")
  245.         {
  246.             $Opt_display = (($origem == 'cons' && !in_array("tem_res_cons"$SC_conf_opt)) || ($origem == 'res' && !in_array("tem_res_res"$SC_conf_opt))) ? ' style="display: none"' '';
  247.         ?>
  248.           <tr><td class='scGridToolbar' colspan=2 style='font-weight: bold;'><?php echo $tradutor[$language]['group_general']; ?></td></tr>

  249.          <tr<?php echo $Opt_display ?>>

  250.            <td class="scGridFieldOddFont" align="left">
  251.             <?php echo $tradutor[$language]['modules']; ?>
  252.            </td>
  253.            <td class="scGridFieldOddFont" align="left">
  254.             <div class="input-group input-group-horizontal">
  255.         <?php
  256.            foreach ($all_modules as $cada_mod)
  257.            {
  258.                $ckeck    = (in_array($cada_mod$ini_pdf_res)) ? "checked" "";
  259.                $set_grid = ($cada_mod == "grid") ? ' onclick="contrl_mod_grid(this)" ' '';
  260.            ?>
  261.              <label>
  262.               <input type=checkbox id="id_tem_res_cons" name="tem_res_cons[]"  <?php echo $ckeck $set_grid ?> value="<?php echo $cada_mod ?>"> <?php echo $tradutor[$language]['mod_' $cada_mod]; ?>
  263.              </label>
  264.            <?php
  265.            }
  266.         ?>
  267.           </div>
  268.          </td>
  269.         </tr>
  270.         <?php
  271.         }
  272.         ?>

  273.         <?php
  274.           $Opt_display = (!in_array("cor_imp"$SC_conf_opt)) ? ' style="display: none"' '';
  275.         ?>
  276.          <tr<?php echo $Opt_display ?>>
  277.            <td class="scGridFieldOddFont">
  278.              <?php echo $tradutor[$language]['tp_imp']; ?>
  279.            </td>
  280.            <td class="scGridFieldOddFont">
  281.              <select  name="cor_imp"  size=1>
  282.                <option value="cor"      <?php if ($cor == "cor")  { echo " selected" ;} ?>><?php echo $tradutor[$language]['color']; ?></option>
  283.                <option value="pb"       <?php if ($cor == "pb")  { echo " selected" ;} ?>><?php echo $tradutor[$language]['econm']; ?></option>
  284.              </select>
  285.            </td>
  286.          </tr>
  287.         <?php
  288.         if ($conf_socor == "N")
  289.         {
  290.             $Opt_display = (!in_array("papel"$SC_conf_opt)) ? ' style="display: none"' '';
  291.         ?>
  292.          <tr<?php echo $Opt_display ?>>
  293.            <td class="scGridFieldOddFont">
  294.              <?php echo $tradutor[$language]['tp_pap']; ?>
  295.            </td>
  296.            <td class="scGridFieldOddFont">
  297.         <?php
  298.           if (!isset($_SESSION['scriptcase']['sc_tp_pdf']) || $_SESSION['scriptcase']['sc_tp_pdf'] == "pd4ml")
  299.           {
  300.         //      echo "     <select  name=\"papel\" size=1 onchange=custom_paper()>\r\n";
  301.               echo "     <select  name=\"papel\" size=1>\r\n";
  302.               echo "       <option value=\"" $tp_papel[1]  . "\""; if ($papel == "1")   { echo " selected" ;} echo ">" $tradutor[$language]['carta'] . " (216 x 279 mm)</option>\r\n";
  303.               echo "       <option value=\"" $tp_papel[2]  . "\""; if ($papel == "2")   { echo " selected" ;} echo ">" $tradutor[$language]['oficio'] . " (216 x 356 mm)</option>\r\n";
  304.               echo "       <option value=\"" $tp_papel[3]  . "\""; if ($papel == "3")   { echo " selected" ;} echo ">Ledger (432 x 279 mm)</option>\r\n";
  305.               echo "       <option value=\"" $tp_papel[4]  . "\""; if ($papel == "4")   { echo " selected" ;} echo ">A0 (841 X 1189 mm)</option>\r\n";
  306.               echo "       <option value=\"" $tp_papel[5]  . "\""; if ($papel == "5")   { echo " selected" ;} echo ">A1 (594 x 841  mm)</option>\r\n";
  307.               echo "       <option value=\"" $tp_papel[6]  . "\""; if ($papel == "6")   { echo " selected" ;} echo ">A2 (420 x 594  mm)</option>\r\n";
  308.               echo "       <option value=\"" $tp_papel[7]  . "\""; if ($papel == "7")   { echo " selected" ;} echo ">A3 (297 x 420  mm)</option>\r\n";
  309.               echo "       <option value=\"" $tp_papel[8]  . "\""; if ($papel == "8")   { echo " selected" ;} echo ">A4 (210 X 297  mm)</option>\r\n";
  310.               echo "       <option value=\"" $tp_papel[9]  . "\""; if ($papel == "9")   { echo " selected" ;} echo ">A5 (148 x 210  mm)</option>\r\n";
  311.               echo "       <option value=\"" $tp_papel[10] . "\""; if ($papel == "10")  { echo " selected" ;} echo ">A6 (105 x 148  mm)</option>\r\n";
  312.               echo "       <option value=\"" $tp_papel[16] . "\""; if ($papel == "16")  { echo " selected" ;} echo ">A7 (74  x 105  mm)</option>\r\n";
  313.               echo "       <option value=\"" $tp_papel[17] . "\""; if ($papel == "17")  { echo " selected" ;} echo ">A8 (52  x 74   mm)</option>\r\n";
  314.               echo "       <option value=\"" $tp_papel[18] . "\""; if ($papel == "18")  { echo " selected" ;} echo ">A9 (37  x 52   mm)</option>\r\n";
  315.               echo "       <option value=\"" $tp_papel[19] . "\""; if ($papel == "19")  { echo " selected" ;} echo ">A10 (26  x 37  mm)</option>\r\n";
  316.               echo "       <option value=\"" $tp_papel[20] . "\""; if ($papel == "20")  { echo " selected" ;} echo ">B0 (1000 x 1414 mm)</option>\r\n";
  317.               echo "       <option value=\"" $tp_papel[21] . "\""; if ($papel == "21")  { echo " selected" ;} echo ">B1 (707  x 1000 mm)</option>\r\n";
  318.               echo "       <option value=\"" $tp_papel[22] . "\""; if ($papel == "22")  { echo " selected" ;} echo ">B2 (500  x 707  mm)</option>\r\n";
  319.               echo "       <option value=\"" $tp_papel[23] . "\""; if ($papel == "23")  { echo " selected" ;} echo ">B3 (353  x 500  mm)</option>\r\n";
  320.               echo "       <option value=\"" $tp_papel[24] . "\""; if ($papel == "24")  { echo " selected" ;} echo ">B4 (250  x 353  mm)</option>\r\n";
  321.               echo "       <option value=\"" $tp_papel[11] . "\""; if ($papel == "11")  { echo " selected" ;} echo ">B5 (176  x 250  mm)</option>\r\n";
  322.               echo "       <option value=\"" $tp_papel[13] . "\""; if ($papel == "13")  { echo " selected" ;} echo ">Tabliod (280 x 432 mm)</option>\r\n";
  323.               echo "       <option value=\"" $tp_papel[25] . "\""; if ($papel == "25")  { echo " selected" ;} echo ">Note (190 x 254 mm)</option>\r\n";
  324.               echo "       <option value=\"" $tp_papel[26] . "\""; if ($papel == "26")  { echo " selected" ;} echo ">HalfLetter (140 x 216 mm)</option>\r\n";
  325.           }
  326.           else
  327.           {
  328.               echo "     <select  name=\"papel\" size=1>\r\n";
  329.               echo "       <option value=\"" $tp_papel[1]  . "\""; if ($papel == "1")   { echo " selected" ;} echo ">" $tradutor[$language]['carta'] . " (216 x 279 mm)</option>\r\n";
  330.               echo "       <option value=\"" $tp_papel[2]  . "\""; if ($papel == "2")   { echo " selected" ;} echo ">" $tradutor[$language]['oficio'] . " (216 x 356 mm)</option>\r\n";
  331.               echo "       <option value=\"" $tp_papel[3]  . "\""; if ($papel == "3")   { echo " selected" ;} echo ">Ledger (432 x 279 mm)</option>\r\n";
  332.               echo "       <option value=\"" $tp_papel[4]  . "\""; if ($papel == "4")   { echo " selected" ;} echo ">A0 (841 X 1189 mm)</option>\r\n";
  333.               echo "       <option value=\"" $tp_papel[5]  . "\""; if ($papel == "5")   { echo " selected" ;} echo ">A1 (594 x 841  mm)</option>\r\n";
  334.               echo "       <option value=\"" $tp_papel[6]  . "\""; if ($papel == "6")   { echo " selected" ;} echo ">A2 (420 x 594  mm)</option>\r\n";
  335.               echo "       <option value=\"" $tp_papel[7]  . "\""; if ($papel == "7")   { echo " selected" ;} echo ">A3 (297 x 420  mm)</option>\r\n";
  336.               echo "       <option value=\"" $tp_papel[8]  . "\""; if ($papel == "8")   { echo " selected" ;} echo ">A4 (210 X 297  mm)</option>\r\n";
  337.               echo "       <option value=\"" $tp_papel[9]  . "\""; if ($papel == "9")   { echo " selected" ;} echo ">A5 (148 x 210  mm)</option>\r\n";
  338.               echo "       <option value=\"" $tp_papel[10] . "\""; if ($papel == "10")  { echo " selected" ;} echo ">A6 (105 x 148  mm)</option>\r\n";
  339.               echo "       <option value=\"" $tp_papel[16] . "\""; if ($papel == "16")  { echo " selected" ;} echo ">A7 (74  x 105  mm)</option>\r\n";
  340.               echo "       <option value=\"" $tp_papel[17] . "\""; if ($papel == "17")  { echo " selected" ;} echo ">A8 (52  x 74   mm)</option>\r\n";
  341.               echo "       <option value=\"" $tp_papel[18] . "\""; if ($papel == "18")  { echo " selected" ;} echo ">A9 (37  x 52   mm)</option>\r\n";
  342.               echo "       <option value=\"" $tp_papel[20] . "\""; if ($papel == "20")  { echo " selected" ;} echo ">B0 (1000 x 1414 mm)</option>\r\n";
  343.               echo "       <option value=\"" $tp_papel[21] . "\""; if ($papel == "21")  { echo " selected" ;} echo ">B1 (707  x 1000 mm)</option>\r\n";
  344.               echo "       <option value=\"" $tp_papel[22] . "\""; if ($papel == "22")  { echo " selected" ;} echo ">B2 (500  x 707  mm)</option>\r\n";
  345.               echo "       <option value=\"" $tp_papel[23] . "\""; if ($papel == "23")  { echo " selected" ;} echo ">B3 (353  x 500  mm)</option>\r\n";
  346.               echo "       <option value=\"" $tp_papel[24] . "\""; if ($papel == "24")  { echo " selected" ;} echo ">B4 (250  x 353  mm)</option>\r\n";
  347.               echo "       <option value=\"" $tp_papel[11] . "\""; if ($papel == "11")  { echo " selected" ;} echo ">B5 (176  x 250  mm)</option>\r\n";
  348.               echo "       <option value=\"" $tp_papel[11] . "\""; if ($papel == "27")  { echo " selected" ;} echo ">B6 (125  x 176  mm)</option>\r\n";
  349.               echo "       <option value=\"" $tp_papel[11] . "\""; if ($papel == "28")  { echo " selected" ;} echo ">B7 (88  x 125  mm)</option>\r\n";
  350.               echo "       <option value=\"" $tp_papel[11] . "\""; if ($papel == "29")  { echo " selected" ;} echo ">B8 (62  x 88  mm)</option>\r\n";
  351.               echo "       <option value=\"" $tp_papel[11] . "\""; if ($papel == "30")  { echo " selected" ;} echo ">B9 (33  x 62  mm)</option>\r\n";
  352.               echo "       <option value=\"" $tp_papel[11] . "\""; if ($papel == "31")  { echo " selected" ;} echo ">B10 (31  x 44  mm)</option>\r\n";
  353.               echo "       <option value=\"" $tp_papel[13] . "\""; if ($papel == "13")  { echo " selected" ;} echo ">Tabliod (280 x 432 mm)</option>\r\n";
  354.               echo "       <option value=\"" $tp_papel[25] . "\""; if ($papel == "25")  { echo " selected" ;} echo ">Executive (190 x 254 mm)</option>\r\n";
  355.               echo "       <option value=\"" $tp_papel[26] . "\""; if ($papel == "32")  { echo " selected" ;} echo ">C5E (163 x 229 mm)</option>\r\n";
  356.               echo "       <option value=\"" $tp_papel[26] . "\""; if ($papel == "33")  { echo " selected" ;} echo ">Comm10E (105 x 241 mm)</option>\r\n";
  357.               echo "       <option value=\"" $tp_papel[26] . "\""; if ($papel == "34")  { echo " selected" ;} echo ">DLE (110 x 220 mm)</option>\r\n";
  358.               echo "       <option value=\"" $tp_papel[26] . "\""; if ($papel == "35")  { echo " selected" ;} echo ">Folio (210 x 330 mm)</option>\r\n";
  359.           }
  360.         ?>
  361.              </select>
  362.            </td>
  363.         </tr>
  364.          <tr id='customiz_papel' style='display: none'>
  365.            <td class="scGridFieldOddFont" align=right>
  366.             <font size="1">
  367.              <?php echo $tradutor[$language]['alt_papel'] . " x " $tradutor[$language]['larg_papel']; ?>
  368.            </td>
  369.            <td class="scGridFieldOddFont">
  370.              <input type=text name="alt_papel"  size=2 maxlength=4 value="<?php echo NM_encode_input($apapel); ?>">&nbsp;x&nbsp;
  371.              <input type=text name="larg_papel" size=2 maxlength=4 value="<?php echo NM_encode_input($lpapel); ?>">&nbsp;mm
  372.            </td>
  373.         </tr>
  374.         <?php
  375.         }

  376.         if ($conf_socor == "N")
  377.         {
  378.             $Opt_display = (!in_array("orientacao"$SC_conf_opt)) ? ' style="display: none"' '';
  379.         ?>
  380.          <tr<?php echo $Opt_display ?>>
  381.            <td class="scGridFieldOddFont">
  382.              <?php echo $tradutor[$language]['orient']; ?>
  383.            </td>
  384.            <td class="scGridFieldOddFont">
  385.              <select  name="orientacao"  size=1>
  386.                <option value="portrait" <?php if ($orientacao == "1")  { echo " selected" ;} ?>><?php echo $tradutor[$language]['retrato']; ?></option>
  387.                <option value="landscape"<?php if ($orientacao == "2")  { echo " selected" ;} ?>><?php echo $tradutor[$language]['paisag']; ?></option>
  388.              </select>
  389.            </td>
  390.         </tr>
  391.         <?php
  392.         }

  393. /* quebras */
  394.          if ($grafico != "XX" && $conf_socor == "N")
  395.          {
  396.             ?>
  397.             <input type="hidden" name="grafico" value="S" />
  398.             <?php
  399.          }

  400.         if ($conf_larg == "S" && $conf_socor == "N")
  401.         {
  402.           if (isset($_SESSION['scriptcase']['sc_tp_pdf']) && $_SESSION['scriptcase']['sc_tp_pdf'] == "wkhtmltopdf")
  403.           {
  404.         ?>
  405.              <input type="hidden" name="largura" value="<?php echo NM_encode_input($largura); ?>" size=6 maxlength=4>
  406.              <input type="hidden" name="fonte" value="<?php echo NM_encode_input($fonte); ?>">
  407.         <?php
  408.           }
  409.           else
  410.           {
  411.         ?>
  412.          <tr>
  413.            <td class="scGridFieldOddFont">
  414.              <?php echo $tradutor[$language]['largura']; ?>
  415.            </td>
  416.            <td class="scGridFieldOddFont">
  417.              <input type="text" name="largura" value="<?php echo NM_encode_input($largura); ?>" size=6 maxlength=4>
  418.            </td>
  419.         </tr>
  420.              <input type="hidden" name="fonte" value="<?php echo NM_encode_input($fonte); ?>">
  421.         <?php
  422.           }
  423.          }

  424.    if ($opc != 'pdf_det')
  425.    {
  426.         $tem_out_opc false;
  427.         ?>
  428.          <tr id="outras_opcoes">
  429.            <td class="scGridFieldOddFont">
  430.              <?php echo $tradutor[$language]['other_options']; ?>
  431.            </td>
  432.            <td class="scGridFieldOddFont">

  433.             <div class="input-group input-group-vertical">
  434.               <?php
  435.                 if ($bookmarks != "XX" && $conf_socor == "N")
  436.                  {
  437.                     $sDisplay = ($opc == 'pdf_det' || $tem_gb_pdf != "s" || !in_array("bookmarks"$SC_conf_opt)) ? ' style="display: none"' '';
  438.                     if (empty($sDisplay)) {$tem_out_opc true;}
  439.                     $check = ($bookmarks == "1") ? " checked" "";
  440.                     ?>
  441.                     <label <?php echo $sDisplay?>><input type="checkbox" id="id_bookmarks" name="bookmarks" value="<?php echo $bookmarks?><?php echo $check?>><?php echo $tradutor[$language]['book']; ?></label>
  442.                     <?php
  443.                  }

  444.               if (in_array("grid"$all_modules) !== false && $SC_ver_93)
  445.               {
  446.                 $check = ($all_cab == "S") ? " checked" "";
  447.                 $sDisplay = (!$ckeck_grid || !in_array("all_cab"$SC_conf_opt)) ? ' style="display: none"' '';
  448.                 if (empty($sDisplay)) {$tem_out_opc true;}
  449.                 ?>
  450.                 <label id="id_grid_cab" <?php echo $sDisplay?>><input type="checkbox" id="id_all_cab" name="all_cab" value="<?php echo $all_cab?><?php echo $check?>><?php echo $tradutor[$language]['page_header']; ?></label>
  451.                 <?php
  452.                 if ($orient_grid == 2)
  453.                 {
  454.                    $check = ($all_label == "S") ? " checked" "";
  455.                    $sDisplay = (!$ckeck_grid || !in_array("all_label"$SC_conf_opt)) ? ' style="display: none"' '';
  456.                    if (empty($sDisplay)) {$tem_out_opc true;}
  457.                    ?>
  458.                    <label id="id_grid_label" <?php echo $sDisplay?>><input type="checkbox" id="id_all_label" name="all_label" onclick="control_all_cab()" value="<?php echo $all_label?><?php echo $check?>><?php echo $tradutor[$language]['page_label']; ?></label>
  459.                    <?php
  460.                    $check = ($label_group == "S") ? " checked" "";
  461.                    $sDisplay = ($tem_gb_pdf != "s" || $origem == "res" || !$ckeck_grid || !in_array("label_group"$SC_conf_opt)) ? ' style="display: none"' '';
  462.                    if (empty($sDisplay)) {$tem_out_opc true;}
  463.                    ?>
  464.                    <label id="id_grid_group" <?php echo $sDisplay?>><input type="checkbox" id="id_label_group" name="label_group" value="<?php echo $label_group?><?php echo $check?>><?php echo $tradutor[$language]['label_group']; ?></label>
  465.                  <?php
  466.                 }
  467.               }
  468.               $check = ($pdf_zip == "S") ? " checked" "";
  469.               $sDisplay = ($ver_93 == "n" || !in_array("pdf_compacted"$SC_conf_opt)) ? ' style="display: none"' '';
  470.               if (empty($sDisplay)) {$tem_out_opc true;}
  471.               ?>
  472.                 <label id="id_grid_zip" <?php echo $sDisplay?>><input type="checkbox" id="id_pdf_zip" name="pdf_zip" value="<?php echo $pdf_zip?><?php echo $check?>><?php echo $tradutor[$language]['format_zip']; ?></label>

  473.              </div>
  474.            </td>
  475.         </tr>
  476.          <?php

  477.         /* conf quebra de pagina */
  478.         if ($origem != "chart" && $opc == 'pdf' && isset($_SESSION['sc_session'][$script_case_init][$app_name]['Page_break_PDF']) && !empty($_SESSION['sc_session'][$script_case_init][$app_name]['Page_break_PDF']) && $_SESSION['sc_session'][$script_case_init][$app_name]['Config_Page_break_PDF'] == "S")
  479.         {
  480.             $Opt_display = (!in_array("page_break"$SC_conf_opt)) ? ' style="display: none"' '';
  481.         ?>
  482.          <tr<?php echo $Opt_display ?>>
  483.            <td class="scGridFieldOddFont">
  484.              <?php echo $tradutor[$language]['page_break']; ?>
  485.            </td>
  486.            <td class="scGridFieldOddFont">
  487.             <div class="input-group input-group-vertical">
  488.         <?php
  489.            $ix_lab 0;
  490.            foreach ($_SESSION['sc_session'][$script_case_init][$app_name]['Page_break_PDF'] as $cmp => $page_br)
  491.            {
  492.                $sel_br = ($page_br == "S") ? " checked" "";
  493.         ?>
  494.              <label>
  495.               <input type="checkbox" id="id_page_break" name="page_break[]" value="<?php echo NM_encode_input($cmp); ?><?php echo $sel_br?>><?php echo $_SESSION['sc_session'][$script_case_init][$app_name]['Labels_GB'][$ix_lab]; ?>
  496.              </label>
  497.         <?php
  498.                $ix_lab++;
  499.            }
  500.         ?>
  501.             </div>
  502.            </td>
  503.         </tr>
  504.         <?php
  505.         }
  506.    }
  507.    elseif ($ver_93 == "s")
  508.    {
  509.         $Opt_display = (!in_array("pdf_compacted"$SC_conf_opt)) ? ' style="display: none"' '';
  510.         if (empty($Opt_display)) {$tem_out_opc true;}
  511.         $check = ($pdf_zip == "S") ? " checked" "";
  512.         ?>
  513.          <tr id="outras_opcoes"<?php echo $Opt_display ?>>
  514.            <td class="scGridFieldOddFont">
  515.              <?php echo $tradutor[$language]['other_options']; ?>
  516.            </td>
  517.            <td class="scGridFieldOddFont">
  518.             <div class="input-group input-group-vertical">
  519.                 <label id="id_grid_zip" <?php echo $sDisplay?>><input type="checkbox" id="id_pdf_zip" name="pdf_zip" value="<?php echo $pdf_zip?><?php echo $check?>><?php echo $tradutor[$language]['format_zip']; ?></label>
  520.             </div>
  521.            </td>
  522.         </tr>
  523.    <?php
  524.    }


  525. // Password
  526.         if ($password == "s")
  527.         {
  528.            $Opt_display = (!in_array("password"$SC_conf_opt)) ? ' style="display: none"' '';
  529.         ?>
  530.          <tr>
  531.            <td class="scGridFieldOddFont" align="left">
  532.                <?php echo $tradutor[$language]['password']; ?>
  533.            </td>
  534.            <td class="scGridFieldOddFont" align="left">
  535.              <input type=password name="password" value="" size=30> </td>
  536.         </tr>
  537.         <?php
  538.         }

  539. // Charts

  540.         $isMultiSeriesChart $is_chart_app && (!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['summarizing_drill_down']) || !$_SESSION['sc_session'][$script_case_init]['grid_new']['summarizing_drill_down']);
  541.         $isAnalitic         = isset($_SESSION['sc_session'][$script_case_init]['grid_new']['graf_opc_atual']) && == $_SESSION['sc_session'][$script_case_init]['grid_new']['graf_opc_atual'];

  542. if ($ver_93 == "n")
  543. {
  544.           $sDisplay = !isset($_SESSION['sc_session']['grid_new']['show_skip_charts_option']) ||
  545.                      !$_SESSION['sc_session']['grid_new']['show_skip_charts_option'] ||
  546.                      (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['SC_Ind_Groupby']) && '_NM_SC_' == $_SESSION['sc_session'][$script_case_init]['grid_new']['SC_Ind_Groupby']) ||
  547.                      $isMultiSeriesChart ||
  548.                      $isAnalitic ||
  549.                      ($opc == 'pdf_det')
  550.                      ? ' style="display: none"' '';
  551.          ?>

  552.          <tr<?php echo $sDisplay?>><td class='scGridToolbar' style='font-weight: bold;' colspan=2><?php echo $tradutor[$language]['group_chart']; ?></td></tr>

  553.          <?php
  554.          $sDisplay $is_chart_app' style="display: none"' $sDisplay;
  555.          ?>
  556.          <tr<?php echo $sDisplay?>>
  557.            <td class="scGridFieldOddFont">
  558.              <?php echo $tradutor[$language]['create']; ?>
  559.            </td>
  560.            <td class="scGridFieldOddFont">
  561.              <select  name="create"  size=1 onchange='hide_level(this);'>
  562.                <option value="S"<?php if ($createCharts == "S")  { echo " selected" ;} ?>><?php echo $tradutor[$language]['sim']; ?></option>
  563.                <option value="N"<?php if ($createCharts == "N")  { echo " selected" ;} ?>><?php echo $tradutor[$language]['nao']; ?></option>
  564.              </select>
  565.            </td>
  566.         </tr>

  567.         <?php
  568. }
  569.         if ($script_case_init != "N" && isset($_SESSION['sc_session'][$script_case_init][$app_name]['Labels_GB']) && !empty($_SESSION['sc_session'][$script_case_init][$app_name]['Labels_GB']))
  570.         {
  571.          $sDisplay =
  572. //                    !isset($_SESSION['sc_session']['grid_new']['show_skip_charts_option']) ||
  573. //                    !$_SESSION['sc_session']['grid_new']['show_skip_charts_option'] ||
  574.                     $isMultiSeriesChart ||
  575.                     $isAnalitic ||
  576. /*                     !in_array("chart_level", $SC_conf_opt) || */
  577.                      ($opc == 'pdf_det')
  578.                     ? ' style="display: none"' '';
  579.          if ($_SESSION['sc_session'][$script_case_init][$app_name]['conf_chart_level'] == "S" && count($_SESSION['sc_session'][$script_case_init][$app_name]['Labels_GB']) > 1)
  580.          {

  581. if ($ver_93 == "s")
  582. {
  583.        ?>

  584.       </table>
  585.       <br />
  586.       <table class="scGridBorder" width='100%' cellspacing="0" cellpadding="0">
  587.          <tr<?php echo $sDisplay?>><td class='scGridToolbar' style='font-weight: bold;' colspan=2><?php echo $tradutor[$language]['group_chart']; ?></td></tr>
  588. <?php
  589. }
  590. ?>

  591.          <tr id='id_chart_level' <?php echo $sDisplay?>>
  592.            <td class="scGridFieldOddFont">
  593.              <?php echo wordwrap($tradutor[$language]['chart_level'], 25"<br>"true); ?>
  594.            </td>
  595.            <td class="scGridFieldOddFont">
  596.             <div class="input-group input-group-vertical">
  597.         <?php
  598.             $ult count($_SESSION['sc_session'][$script_case_init][$app_name]['Labels_GB']) - 1;
  599.             foreach ($_SESSION['sc_session'][$script_case_init][$app_name]['Labels_GB'] as $ind => $gb)
  600.             {
  601.                $selected = ($ult == $ind) ? " checked" "";
  602.         ?>
  603.               <label><input type="radio" name="chart_level" value=<?php echo $ind $selected ?>><?php echo $gb ?></label>
  604.         <?php
  605.             }
  606.         ?>
  607.             </div>
  608.            </td>
  609.         </tr>
  610.         <?php
  611.          }
  612.         }
  613.         ?>

  614.         </table>


  615.     </div>
  616.     <div id="tabs-sel-columns" style="padding: 0px; margin: 0px; display:none">

  617.         <?php
  618.         if($hasSelColumns)
  619.         {
  620.           $bol_sel_campos_include true;
  621.           include($app_name "_sel_campos.php");
  622.           $class_name = (is_numeric(substr($app_name01))) ? "_" $app_name $app_name;
  623.           $sel_campos $class_name "_sel_cmp";
  624.           $sel_campos = new $sel_campos($bol_sel_campos_include$script_case_init);
  625.           $sel_campos->Sel_cmp_init();
  626.           $sel_campos->Sel_cmp_init_fields();
  627.           $sel_campos->displayHtml(false);
  628.         }
  629.         ?>

  630.     </div>

  631.   </div>
  632.   <div class="buttons">
  633.     <?php
  634.     echo  $_SESSION['scriptcase']['bg_btn_popup']['bok'];
  635.     echo  "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  636.     echo  $_SESSION['scriptcase']['bg_btn_popup']['btbremove'];
  637.     ?>
  638.   </div>

  639.  </td>
  640.  </tr>
  641. </table>

  642. <?php
  643. if ($bookmarks == "XX" || $conf_socor == "S")
  644. {
  645.     $book $bookmarks;
  646.     if ($bookmarks == "XX")
  647.     {
  648.         $book 2;
  649.     }
  650. ?>
  651.     <input type="hidden" name="bookmarks" value="<?php echo NM_encode_input($book); ?>">
  652. <?php
  653. }
  654. if ($conf_larg != "S" || $conf_socor == "S")
  655. {
  656. ?>
  657.     <input type="hidden" name="largura" value="<?php echo NM_encode_input($largura); ?>">
  658.     <input type="hidden" name="fonte" value="<?php echo NM_encode_input($fonte); ?>">
  659. <?php
  660. }
  661. if ($grafico == "XX" || $conf_socor == "S")
  662. {
  663.     $graf $grafico;
  664.     if ($grafico == "XX")
  665.     {
  666.         $graf 2;
  667.     }
  668. ?>
  669.     <input type="hidden" name="grafico" value="<?php echo NM_encode_input($graf); ?>">
  670. <?php
  671. }
  672. if ($conf_socor == "S")
  673. {
  674.     if (!isset($_SESSION['scriptcase']['sc_tp_pdf']) || $_SESSION['scriptcase']['sc_tp_pdf'] == "pd4ml")
  675.     {
  676.         $orient = ($orientacao == "1") ? "portrait" "landscape";
  677.     }
  678.     else
  679.     {
  680.         $orient = ($orientacao == "1") ? "Portrait" "Landscape";
  681.     }
  682.     $dim_papel $tp_papel[$papel];
  683. ?>
  684.     <input type="hidden" name="papel" value="<?php echo NM_encode_input($dim_papel); ?>">
  685.     <input type="hidden" name="orientacao" value="<?php echo NM_encode_input($orient); ?>">
  686. <?php
  687. }

  688. ?>
  689. </form>
  690. <script language="javascript">
  691. <?php
  692.  if ($conf_socor == "N")
  693.  {
  694. ?>
  695.  // custom_paper();
  696. <?php
  697.  }
  698. ?>
  699. var bFixed = false;
  700. function ajusta_window()
  701. {
  702.   var mt   = $(document.getElementById("main_table"));
  703.   var mt1  = $(document.getElementById("tabs-general"));
  704.   altura  = mt1.height();
  705.   largura = mt1.width();
  706.   if($('#tabs-sel-columns').length > 0)
  707.   {
  708.     mt2  = $(document.getElementById("tabs-sel-columns"));
  709.     if(mt2.height() > altura)
  710.     {
  711.       altura = mt2.height();
  712.     }
  713.     if(mt2.width() > largura)
  714.     {
  715.       largura = mt2.width();
  716.     }
  717.   }

  718.   //protect against max windows
  719.   if((altura + 220) > parent.window.innerHeight) altura = parent.window.innerHeight - 220;

  720.   if (0 == largura || 0 == altura)
  721.   {
  722.     setTimeout("ajusta_window()", 50);
  723.     return;
  724.   }
  725.   else if(!bFixed)
  726.   {
  727.     bFixed = true;
  728.     if (navigator.userAgent.indexOf("Chrome/") > 0)
  729.     {
  730.       self.parent.tb_resize(altura + 180, largura + 50);
  731.       setTimeout("ajusta_window()", 50);
  732.       return;
  733.     }
  734.   }
  735.   mt.width( largura );
  736.   self.parent.tb_resize(altura + 180, largura + 50);
  737. }

  738. $('#tabs > ul > li').click(function() {
  739.   if($(this).find("a").length)
  740.   {
  741.     $('#tabs > ul > li').removeClass("scTabActive");
  742.     $('#tabs > ul > li').addClass("scTabInactive");

  743.     $(this).removeClass("scTabInactive");
  744.     $(this).addClass("scTabActive");

  745.     $('#tabs > div').hide();
  746.     $($(this).find("a").attr("href")).show();
  747.   }
  748. });
  749. $( document ).ready(function() {
  750.    setTimeout("ajusta_window();", 50);
  751. <?php
  752.    if (isset($tem_out_opc) && !$tem_out_opc)
  753.    {
  754. ?>
  755.    document.getElementById('outras_opcoes').style.display = 'none';
  756. <?php
  757.    }
  758. ?>
  759. });

  760.   function scSubmitSelCamposAjaxExportDone()
  761.   {
  762.     saveSelColumns = true;
  763.     processa();
  764.   }

  765.   var saveSelColumns = false;
  766.   function processa()
  767.   {
  768.      <?php
  769.      if($hasSelColumns)
  770.      {
  771.       ?>
  772.       if(saveSelColumns == false)
  773.       {
  774.         scSubmitSelCamposAjaxExport();
  775.         return false;
  776.       }
  777.       <?php
  778.      }
  779.      ?>

  780.      <?php
  781.      if($export_ajax != "S" && $export_ajax != "R" && $export_ajax != "D")
  782.      {
  783.       ?>
  784.       self.parent.tb_remove();
  785.       <?php
  786.      }
  787.      ?>
  788.      ind    = document.config_pdf.cor_imp.selectedIndex;
  789.      cor    = document.config_pdf.cor_imp.options[ind].value;
  790.      create = '';
  791. <?php
  792. if ($ver_93 == "n")
  793. {
  794. ?>
  795.      create = document.config_pdf.create.options[document.config_pdf.create.selectedIndex].value;
  796. <?php
  797.  }


  798.  if ($conf_socor == "N")
  799.  {
  800. ?>
  801.      ind        = document.config_pdf.papel.selectedIndex;
  802.      papel      = document.config_pdf.papel.options[ind].value;
  803.      larg_papel = document.config_pdf.larg_papel.value;
  804.      alt_papel  = document.config_pdf.alt_papel.value;
  805.      ind        = document.config_pdf.orientacao.selectedIndex;
  806.      orientacao = document.config_pdf.orientacao.options[ind].value;
  807. <?php
  808.  }
  809.  else
  810.  {
  811. ?>
  812.      papel      = document.config_pdf.papel.value;
  813.      orientacao = document.config_pdf.orientacao.value;
  814. <?php
  815.  }
  816.  if ($bookmarks != "XX" && $conf_socor == "N")
  817.  {
  818. ?>
  819.   bookmarks = (document.getElementById('id_bookmarks') && document.getElementById('id_bookmarks').checked) ?  "S" : "N";
  820. <?php
  821.  }
  822.  else
  823.  {
  824. ?>
  825.      bookmarks  = document.config_pdf.bookmarks.value;
  826. <?php
  827.  }
  828. ?>

  829.  res_cons = "";
  830.  if (document.config_pdf.id_tem_res_cons)
  831.  {
  832.      Nobj = document.getElementById('id_tem_res_cons').name;
  833.      obj  = document.getElementsByName(Nobj);
  834.      for (iCheck = 0; iCheck < obj.length; iCheck++) {
  835.           if (obj[iCheck].checked) {
  836.               if (res_cons != "") {
  837.                  res_cons += ",";
  838.               }
  839.               res_cons += obj[iCheck].value;
  840.           }
  841.      }
  842.  }
  843.  else
  844.  {
  845.      res_cons = "<?php if ($origem == "cons") {echo "grid";} else {echo "resume,chart";} ?>";
  846.  }
  847.  if (res_cons == "")
  848.  {
  849.     return;
  850.  }

  851.  s_label_group = (document.getElementById('id_label_group') && document.getElementById('id_label_group').checked) ?  "S" : "N";
  852.  s_all_cab     = (document.getElementById('id_all_cab') && document.getElementById('id_all_cab').checked) ?  "S" : "N";
  853.  s_all_label   = (document.getElementById('id_all_label') && document.getElementById('id_all_label').checked) ?  "S" : "N";
  854.  s_pdf_zip     = (document.getElementById('id_pdf_zip') && document.getElementById('id_pdf_zip').checked) ?  "S" : "N";
  855.  if (s_all_label == "S") {
  856.      s_all_cab = "S";
  857.  }

  858.  use_pass = "";
  859. <?php
  860.  if($password == "s")
  861.  {
  862. ?>
  863.      use_pass = document.config_pdf.password.value;
  864. <?php
  865.  }



  866. ?>
  867.  grafico    = document.config_pdf.grafico.value;

  868.      largura    = document.config_pdf.largura.value;
  869.      fonte      = document.config_pdf.fonte.value;
  870.      parms_pdf = " ";
  871. <?php
  872.   if (!isset($_SESSION['scriptcase']['sc_tp_pdf']) || $_SESSION['scriptcase']['sc_tp_pdf'] == "pd4ml")
  873.   {
  874. ?>
  875.      if (largura > 0)
  876.      {
  877.          parms_pdf += largura;
  878.      }
  879.      else
  880.      {
  881.          parms_pdf += 800;
  882.      }
  883.      parms_pdf += ' ' + papel;
  884.      parms_pdf += ' -orientation ' + orientacao.toUpperCase();
  885.      if (bookmarks == 'S')
  886.      {
  887.          parms_pdf += ' -bookmarks HEADINGS';
  888.      }
  889. <?php
  890.   }
  891.   else
  892.   {
  893. ?>
  894.      parms_pdf += ' --page-size ' + papel;
  895.      if (orientacao.toUpperCase() == 'PORTRAIT')
  896.      {
  897.          parms_pdf += ' --orientation Portrait';
  898.      }
  899.      else
  900.      {
  901.          parms_pdf += ' --orientation Landscape';
  902.      }
  903.      if (bookmarks == 'N')
  904.      {
  905.          parms_pdf += ' --outline-depth 0';
  906.      }
  907. <?php
  908.   }
  909. ?>
  910.      chart_level = "";
  911.      if (document.config_pdf.chart_level) {
  912.         chart_level = document.config_pdf.chart_level.value;
  913.      }

  914.      page_break = "_NO_";
  915.      if (document.getElementById('id_page_break')) {
  916.          page_break = "";
  917.          Nobj = document.getElementById('id_page_break').name;
  918.          obj  = document.getElementsByName(Nobj);
  919.          if (!obj.length) {
  920.              if (obj.checked) {
  921.                  page_break = obj.value;
  922.              }
  923.          }
  924.          else {
  925.              for (iCheck = 0; iCheck < obj.length; iCheck++) {
  926.                  if (obj[iCheck].checked) {
  927.                      page_break += (page_break != "") ? "_BRK_" : "";
  928.                      page_break += obj[iCheck].value;
  929.                  }
  930.              }
  931.          }
  932.      }
  933.      parent.nm_gp_move('<?php echo NM_encode_input($opc); ?>', '<?php echo NM_encode_input($target); ?>', cor, parms_pdf, grafico, create, '<?php echo NM_encode_input($export_ajax); ?>', chart_level, page_break, res_cons, use_pass, s_all_cab, s_all_label, s_label_group, s_pdf_zip);return false;

  934.      $('#bsair').click();
  935.   }

  936.   function control_all_cab()
  937.   {
  938.      if (document.getElementById('id_all_label').checked) {
  939.          document.getElementById('id_all_cab').checked = true;
  940.          document.getElementById('id_all_cab').disabled = true;
  941.      }
  942.      else
  943.      {
  944.          document.getElementById('id_all_cab').disabled = false;
  945.      }
  946.   }

  947.   function contrl_mod_grid(obj)
  948.   {
  949.      if (obj.checked)
  950.      {
  951.          document.getElementById('id_grid_group').style.display = '';
  952.          document.getElementById('id_grid_cab').style.display = '';
  953.          document.getElementById('id_grid_label').style.display = '';
  954.      }
  955.      else
  956.      {
  957.          document.getElementById('id_grid_group').style.display = 'none';
  958.          document.getElementById('id_grid_cab').style.display = 'none';
  959.          document.getElementById('id_grid_label').style.display = 'none';
  960.      }
  961.      ajusta_window();
  962.   }

  963.   function custom_paper()
  964.   {
  965.      ind   = document.config_pdf.papel.selectedIndex;
  966.      papel = document.config_pdf.papel.options[ind].value;
  967.      if (papel != 'custom')
  968.      {
  969.          document.getElementById('customiz_papel').style.display = 'none';
  970.      }
  971.      else
  972.      {
  973.          document.getElementById('customiz_papel').style.display = '';
  974.      }
  975.      ajusta_window();
  976.   }

  977.   function hide_level(obj_graf)
  978.   {
  979.      if (document.getElementById('id_chart_level'))
  980.      {
  981.          var index = obj_graf.selectedIndex;
  982.          var parm  = obj_graf.options[index].value;
  983.          if (parm != 'S')
  984.          {
  985.              document.getElementById('id_chart_level').style.display = 'none';
  986.          }
  987.          else
  988.          {
  989.              document.getElementById('id_chart_level').style.display = '';
  990.          }
  991.          ajusta_window();
  992.      }
  993.   }

  994. </script>
  995. <script>
  996.      //colocado aqui devido a execu�ao modal naoo executar o ready do jquery
  997.      window.onload = function(){
  998.          setTimeout("ajusta_window()", 50);
  999.          if (document.getElementById('id_all_cab') && document.getElementById('id_all_label')) {
  1000.              control_all_cab();
  1001.          }
  1002.      }
  1003. </script>
  1004. </body>
  1005. </html>
Return
grid_new_config_print.php
  1. <?php
  2. /**
  3.  * $Id: nm_gp_config_print.php,v 1.2 2012-01-27 13:02:59 sergio Exp $
  4.  */
  5.     include_once('grid_new_session.php');
  6.     session_start();
  7.     $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  8.     //check tmp
  9.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  10.     {
  11.         $str_path_apl_url $_SERVER['PHP_SELF'];
  12.         $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  13.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  14.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  15.         /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  16.     }
  17.     $SC_cod_proj "Projeto7";
  18.     $SC_apl_proc "grid_new";
  19.     $SC_conf_opt explode(",","tem_res_cons,tem_res_res,opc,cor");
  20. /* sc_apl_default */
  21.     if (!isset($_SESSION['sc_session']))
  22.     {
  23.         $NM_dir_atual getcwd();
  24.         if (empty($NM_dir_atual))
  25.         {
  26.             $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  27.             $str_path_sys  str_replace("\\"'/'$str_path_sys);
  28.         }
  29.         else
  30.         {
  31.             $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  32.             $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  33.         }
  34.         $str_path_web    $_SERVER['PHP_SELF'];
  35.         $str_path_web    str_replace("\\"'/'$str_path_web);
  36.         $str_path_web    str_replace('//''/'$str_path_web);
  37.         $root            substr($str_path_sys0, -strlen($str_path_web));
  38.         if (is_file($root $_SESSION['scriptcase'][$SC_apl_proc]['glo_nm_path_imag_temp'] . "/sc_apl_default_" $SC_cod_proj ".txt"))
  39.         {
  40. ?>
  41.             <script language="javascript">
  42.                parent.nm_move();
  43.             </script>
  44. <?php
  45.             exit;
  46.         }
  47.     }
  48.     $opc          = (isset($_GET['nm_opc']))   ? $_GET['nm_opc']   : "RC";
  49.     $cor          = (isset($_GET['nm_cor']))   ? $_GET['nm_cor']   : "CO";
  50.     $language     = (isset($_GET['language'])) ? $_GET['language'] : "port";
  51.     $page         = (isset($_GET['nm_page']))  ? $_GET['nm_page']  : '';
  52.     $res_cons     = (isset($_GET['nm_res_cons']))    ? $_GET['nm_res_cons']    : "n";
  53.     $origem       = (isset($_GET['origem']))         ? $_GET['origem']         : "cons";
  54.     $ini_prt_res  = (isset($_GET['nm_ini_prt_res'])) ? explode(","$_GET['nm_ini_prt_res']) : array();
  55.     $all_modules  = (isset($_GET['nm_all_modules'])) ? explode(","$_GET['nm_all_modules']) : array();
  56.     $password     = (isset($_GET['password']))       ? $_GET['password']       : "s";

  57. /*--- exportacoes ajax */
  58.     $export_ajax = (isset($_GET['export_ajax'])) ? $_GET['export_ajax'] : 'N';
  59. /*--------*/
  60.     $script_case_init = (isset($_GET['script_case_init'])) ? filter_input(INPUT_GET'script_case_init'FILTER_SANITIZE_NUMBER_INT) : 'N';
  61.     $hasSelColumns    = (isset($_GET['summary_export_columns']))  ? 'S' == filter_input(INPUT_GET'summary_export_columns'FILTER_SANITIZE_STRING) : false;
  62.     if (isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order']) && $opc != 'detalhe') {
  63.         foreach ($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'] as $ind => $cada_cmp) {
  64.             if (!isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['labels'][$cada_cmp])) {
  65.                $hasSelColumns false;
  66.             }
  67.         }
  68.     }
  69.     else {
  70.          $hasSelColumns false;
  71.     }
  72. /*
  73.     if (!in_array("campos_sel", $SC_conf_opt)) {
  74.         $hasSelColumns = false;
  75.     }
  76. */
  77.     ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  78.     if (!function_exists("NM_is_utf8"))
  79.     {
  80.         include_once("../_lib/lib/php/nm_utf8.php");
  81.     }

  82.     $tradutor = array();
  83.     if (isset($_SESSION['scriptcase']['sc_idioma_prt']))
  84.     {
  85.         $tradutor $_SESSION['scriptcase']['sc_idioma_prt'];
  86.     }
  87.     if (!isset($tradutor[$language]))
  88.     {
  89.         foreach ($tradutor as $language => $resto)
  90.         {
  91.             break;
  92.         }
  93.     }
  94.     if (!isset($tradutor[$language]))
  95.     {
  96.                 exit;
  97.     }

  98. ?>
  99. <html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  100. <head>
  101.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html']; ?>" />
  102. <?php
  103. if ((isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])  || (isset($_SESSION['scriptcase']['device_mobile']) && $_SESSION['scriptcase']['device_mobile'] && $_SESSION['scriptcase']['display_mobile']))
  104. {
  105. ?>
  106.  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  107. <?php
  108. }
  109. ?>
  110. <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" />
  111.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" />
  112.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab'?>" />
  113.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab_dir'?>" />
  114.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div'?>" />
  115.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div_dir'?>" />
  116.  <?php
  117.   if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  118.   {
  119.     ?>
  120.     <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts']; ?>" />
  121.     <?php
  122.   }
  123.  ?>
  124.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" />
  125.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/css/smoothness/jquery-ui.css" />
  126.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" />
  127. </head>
  128. <body class="scGridPage" style="margin: 0px; overflow-x: hidden">

  129. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  130. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery-ui.js"></script>
  131. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>

  132. <form name="config_prt" method="post" action="" autocomplete="off">
  133. <?php
  134. $pos "left";
  135. if ($_SESSION['scriptcase']['reg_conf']['html_dir'] == " DIR='RTL'")
  136. {
  137.     $pos "right";
  138. }
  139. ?>
  140. <table id="main_table" class="exportConfig" style="position: relative; top: 20px; <?php echo $pos?>: 20px">
  141. <tr>
  142.  <td align="center">

  143.   <div id="tabs">
  144.     <ul class="scAppDivTabLine" style="display:<?php echo ($hasSelColumns)?"":"none"?>">
  145.       <li class="scTabActive"><a href="#tabs-general"><?php echo $tradutor[$language]['titulo']; ?></a></li>
  146.       <li class="scTabInactive"><a href="#tabs-sel-columns"><?php echo $tradutor[$language]['titulo_colunas']; ?></a></li>
  147.     </ul>
  148.     <div id="tabs-general" style="padding: 0px; margin: 0px">

  149.       <table class="scGridBorder" width='100%' cellspacing="0" cellpadding="0">
  150.           <tr style="display:<?php echo ($hasSelColumns)?"none":""?>">
  151.             <td colspan=2 class="scGridLabelVert"><?php echo $tradutor[$language]['titulo']; ?></td>
  152.           </tr>
  153.           <tr><td nowrap class='scGridToolbar' colspan=2 style='font-weight: bold;'><?php echo $tradutor[$language]['group_general']; ?></td></tr>
  154.           <?php
  155.            if (count($all_modules) < 2)
  156.           {
  157.           ?>
  158.              <tr id="id_sel_modules_hidden" style="display: none">
  159.                <td nowrap>
  160.                 <div class="input-group input-group-horizontal">
  161.           <?php
  162.                foreach ($all_modules as $cada_mod)
  163.                {
  164.                    $ckeck = (in_array($cada_mod$ini_prt_res)) ? "checked" "";
  165.                    echo $tradutor[$language]['mod_' $cada_mod];
  166.           ?>
  167.                  <label><input type=checkbox id="id_tem_res_cons" name="tem_res_cons[]"  <?php echo $ckeck ?> value="<?php echo $cada_mod ?>"></label>
  168.           <?php
  169.                }
  170.           ?>
  171.                 </div>
  172.                </td>
  173.              </tr>
  174.           <?php
  175.           }
  176.           else
  177.           {
  178.              $Opt_display = (($origem == 'cons' && !in_array("tem_res_cons"$SC_conf_opt)) || ($origem == 'res' && !in_array("tem_res_res"$SC_conf_opt))) ? true false;
  179.              $sDisplay = ($opc == "PC" || $res_cons != "s" || $origem == "chart" || $origem == "form" || $Opt_display) ? ' style="display: none"' '';
  180.           ?>
  181.              <tr id="id_sel_modules_rc" <?php echo $sDisplay ?>>
  182.                <td nowrap class="scGridFieldOddFont" align="left">
  183.                 <?php echo $tradutor[$language]['modules']; ?>
  184.                </td>
  185.                <td nowrap class="scGridFieldOddFont" align="left" nowrap>
  186.                 <div class="input-group input-group-horizontal">
  187.           <?php
  188.                foreach ($all_modules as $cada_mod)
  189.                {
  190.                    $ckeck = (in_array($cada_mod$ini_prt_res)) ? "checked" "";
  191.           ?>
  192.                  <label><input type=checkbox id="id_tem_res_cons" name="tem_res_cons[]"  <?php echo $ckeck ?> value="<?php echo $cada_mod ?>"></label>
  193.           <?php
  194.                    echo $tradutor[$language]['mod_' $cada_mod];
  195.                }
  196.           ?>
  197.               </div>
  198.               </td>
  199.              </tr>
  200.           <?php
  201.             $sDisplay = ($opc == "RC" || $res_cons != "s" || $origem != "cons" || $Opt_display) ? ' style="display: none"' '';
  202.           ?>
  203.              <tr id="id_sel_modules_pc" <?php echo $sDisplay ?>>
  204.                <td nowrap class="scGridFieldOddFont" align="left">
  205.                 <?php echo $tradutor[$language]['modules']; ?>
  206.                </td>
  207.                <td nowrap class="scGridFieldOddFont" align="left">
  208.                 <div class="input-group input-group-horizontal">
  209.                  <label><input type=checkbox id="id_tem_res_cons_pc" name="tem_res_cons_pc[]" disabled checked value="grid"><?php echo $tradutor[$language]['mod_grid'?></label>
  210.                </div>
  211.               </td>
  212.              </tr>
  213.           <?php
  214.           }
  215.          if ($origem == "res" || $origem == "form" || $origem == "chart" || (isset($_SESSION['sc_session'][$page][$SC_apl_proc]['scroll_navigate_app']) && $_SESSION['sc_session'][$page][$SC_apl_proc]['scroll_navigate_app']))
  216.           {
  217.               $opc "RC";
  218.           ?>
  219.             <input type="hidden" name="opc" value="RC" />
  220.           <?php
  221.           }
  222.           elseif ($opc != 'detalhe')
  223.           {
  224.               $Opt_display = (!in_array("opc"$SC_conf_opt)) ? ' style="display: none"' '';
  225.           ?>
  226.            <tr<?php echo $Opt_display ?>>
  227.              <td nowrap class="scGridFieldOddFont" align="left">
  228.                  <?php echo $tradutor[$language]['modoimp']; ?>
  229.              </td>
  230.              <td nowrap class="scGridFieldOddFont" align="left">
  231.               <div class="input-group input-group-vertical">
  232.               <?php
  233.                    $ckeck = ($opc == "PC") ? "checked" "";
  234.               ?>
  235.                 <label><input type=radio name="opc" value="PC" onclick="control_modules('PC')" <?php echo $ckeck ?>><?php echo $tradutor[$language]['curr']; ?></label>
  236.               <?php
  237.                    $ckeck = ($opc == "RC") ? "checked" "";
  238.               ?>
  239.                 <label><input type=radio name="opc" value="RC" onclick="control_modules('RC')" <?php echo $ckeck ?>><?php echo $tradutor[$language]['total']; ?></label>
  240.               </div>
  241.              </td>
  242.            </tr>
  243.           <?php
  244.           }
  245.           $Opt_display = (!in_array("cor"$SC_conf_opt)) ? ' style="display: none"' '';
  246.           ?>
  247.            <tr<?php echo $Opt_display ?>>
  248.              <td nowrap class="scGridFieldOddFont" align="left">
  249.                  <?php echo $tradutor[$language]['cor']; ?>
  250.              </td>
  251.              <td nowrap class="scGridFieldOddFont" align="left">
  252.               <div class="input-group input-group-vertical">
  253.               <?php
  254.                    $ckeck = ($cor == "PB") ? "checked" "";
  255.               ?>
  256.                <label><input type=radio name="cor" value="PB" <?php echo $ckeck ?>><?php echo $tradutor[$language]['pb']; ?></label>
  257.               <?php
  258.                    $ckeck = ($cor == "CO") ? "checked" "";
  259.               ?>
  260.                <label><input type=radio name="cor" value="CO" <?php echo $ckeck ?>><?php echo $tradutor[$language]['color']; ?></label>
  261.              </div>
  262.              </td>
  263.           </tr>

  264.      <?php
  265.       if ($password == "s")
  266.       {
  267.       ?>
  268.        <tr>
  269.          <td nowrap class="scGridFieldOddFont" align="left">
  270.              <?php echo $tradutor[$language]['password']; ?>
  271.          </td>
  272.          <td nowrap class="scGridFieldOddFont" align="left">
  273.            <input type=password name="password" value="" size=30> </td>
  274.       </tr>
  275.       <?php
  276.       }
  277.       ?>

  278.           </table>
  279.     </div>
  280.     <div id="tabs-sel-columns" style="padding: 0px; margin: 0px; display:none">

  281.         <?php
  282.         if($hasSelColumns)
  283.         {
  284.           $bol_sel_campos_include true;
  285.           if(!isset($app_name))
  286.           {
  287.             $app_name $SC_apl_proc;
  288.           }
  289.           include($app_name "_sel_campos.php");
  290.           $class_name = (is_numeric(substr($app_name01))) ? "_" $app_name $app_name;
  291.           $sel_campos $class_name "_sel_cmp";
  292.           $sel_campos = new $sel_campos($bol_sel_campos_include$script_case_init);
  293.           $sel_campos->Sel_cmp_init();
  294.           $sel_campos->Sel_cmp_init_fields();
  295.           $sel_campos->displayHtml(false);
  296.         }
  297.         ?>

  298.     </div>
  299.   </div>
  300.   <div class="buttons">
  301.     <?php
  302.     echo  $_SESSION['scriptcase']['bg_btn_popup']['bok'];
  303.     echo  "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  304.     echo  $_SESSION['scriptcase']['bg_btn_popup']['btbremove'];
  305.     ?>
  306.   </div>

  307.  </td>
  308.  </tr>
  309. </table>
  310. </form>


  311. <script language="javascript">

  312. var bFixed = false;

  313. function ajusta_window()
  314. {
  315.   var mt   = $(document.getElementById("main_table"));
  316.   var mt1  = $(document.getElementById("tabs-general"));
  317.   altura  = mt1.height();
  318.   largura = mt1.width();
  319.   if($('#tabs-sel-columns').length > 0)
  320.   {
  321.     mt2  = $(document.getElementById("tabs-sel-columns"));
  322.     if(mt2.height() > altura)
  323.     {
  324.       altura = mt2.height();
  325.     }
  326.     if(mt2.width() > largura)
  327.     {
  328.       largura = mt2.width();
  329.     }
  330.   }

  331.   //protect against max windows
  332.   if((altura + 220) > parent.window.innerHeight) altura = parent.window.innerHeight - 220;

  333.   if (0 == largura || 0 == altura)
  334.   {
  335.     setTimeout("ajusta_window()", 50);
  336.     return;
  337.   }
  338.   else if(!bFixed)
  339.   {
  340.     bFixed = true;
  341.     if (navigator.userAgent.indexOf("Chrome/") > 0)
  342.     {
  343.       self.parent.tb_resize(altura + 150, largura + 40);
  344.       setTimeout("ajusta_window()", 50);
  345.       return;
  346.     }
  347.   }
  348.   mt.width( largura );
  349.   self.parent.tb_resize(altura + 150, largura + 40);
  350. }

  351. $('#tabs > ul > li').click(function() {
  352.   if($(this).find("a").length)
  353.   {
  354.     $('#tabs > ul > li').removeClass("scTabActive");
  355.     $('#tabs > ul > li').addClass("scTabInactive");

  356.     $(this).removeClass("scTabInactive");
  357.     $(this).addClass("scTabActive");

  358.     $('#tabs > div').hide();
  359.     $($(this).find("a").attr("href")).show();
  360.   }
  361. });
  362. $( document ).ready(function() {
  363.    setTimeout("ajusta_window();$('#tabs > ul > li:first-child').click();", 50);
  364. <?php
  365.   if ($password == "s")
  366.   {
  367. ?>
  368.    document.config_prt.password.value = "";
  369. <?php
  370.   }
  371. ?>
  372. });

  373.   function scSubmitSelCamposAjaxExportDone()
  374.   {
  375.     saveSelColumns = true;
  376.     processa();
  377.   }

  378.   function control_modules(tp_imp)
  379.   {
  380. <?php
  381.       if ($res_cons != "s")
  382.       {
  383. ?>
  384.       return;
  385. <?php
  386.       }
  387.       else
  388.       {
  389. ?>
  390.         if (tp_imp == 'RC') {
  391.             document.getElementById('id_sel_modules_rc').style.display = '';
  392.             document.getElementById('id_sel_modules_pc').style.display = 'none';
  393.         }
  394.         else {
  395.             document.getElementById('id_sel_modules_pc').style.display = '';
  396.             document.getElementById('id_sel_modules_rc').style.display = 'none';
  397.         }
  398.         ajusta_window();
  399. <?php
  400.       }
  401. ?>
  402.   }

  403.   var saveSelColumns = false;
  404.   function processa()
  405.   {
  406.      <?php
  407.      if($hasSelColumns)
  408.      {
  409.       ?>
  410.       if(saveSelColumns == false)
  411.       {
  412.         scSubmitSelCamposAjaxExport();
  413.         return false;
  414.       }
  415.       <?php
  416.      }
  417.      ?>

  418.      <?php
  419.      if($export_ajax != "S" && $export_ajax != "R" && $export_ajax != "D")
  420.      {
  421.       ?>
  422.       self.parent.tb_remove();
  423.       <?php
  424.      }
  425.      ?>
  426.      var opc = "<?php echo NM_encode_input($opc);?>";
  427.      var cor = "<?php echo NM_encode_input($cor);?>";
  428. <?php
  429.     if ($opc == 'detalhe' || (isset($_SESSION['sc_session'][$page][$SC_apl_proc]['scroll_navigate_app']) && $_SESSION['sc_session'][$page][$SC_apl_proc]['scroll_navigate_app']))
  430.     {
  431. ?>
  432.      opc = "RC";
  433. <?php
  434.     }
  435.     else
  436.     {
  437. ?>
  438.      opc = (document.config_prt.opc[0] && document.config_prt.opc[0].checked) ? "PC" : "RC";
  439. <?php
  440.     }
  441. ?>
  442.      cor = (document.config_prt.cor[0] && document.config_prt.cor[0].checked) ? "PB" : "CO";

  443.  res_cons = "";
  444.  if (opc == "PC")
  445.  {
  446.      res_cons = "grid";
  447.  }
  448.  else
  449.  {
  450. <?php
  451.    if ($origem == "chart")
  452.    {
  453. ?>
  454.       res_cons = "chart";
  455. <?php
  456.    }
  457.    else
  458.    {
  459. ?>
  460.      if (document.config_prt.id_tem_res_cons)
  461.      {
  462.          Nobj = document.getElementById('id_tem_res_cons').name;
  463.          obj  = document.getElementsByName(Nobj);
  464.          for (iCheck = 0; iCheck < obj.length; iCheck++) {
  465.               if (obj[iCheck] && obj[iCheck].checked) {
  466.                   if (res_cons != "") {
  467.                      res_cons += ",";
  468.                   }
  469.                   res_cons += obj[iCheck].value;
  470.               }
  471.          }
  472.      }
  473.      else
  474.      {
  475.          res_cons = "<?php if ($origem == "cons") {echo "grid";} else {echo "resume,chart";} ?>";
  476.      }
  477. <?php
  478.    }
  479. ?>
  480.  }
  481.  use_pass = "";
  482. <?php
  483.  if($password == "s")
  484.  {
  485. ?>
  486.     use_pass = document.config_prt.password.value;
  487. <?php
  488.  }
  489. ?>

  490.  if (res_cons == "")
  491.  {
  492.     return;
  493.  }


  494. /*--- exportacoes ajax */
  495. /*     parent.nm_gp_print_conf(opc, cor);return false; */
  496. <?php
  497.      if ($export_ajax == 'S') {
  498. ?>
  499.          parent.nm_gp_print_conf(opc, cor, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', 'print', false);return false;
  500. <?php
  501.      }
  502.      else if ($export_ajax == 'R') {
  503. ?>
  504.          parent.nm_gp_print_conf(opc, cor, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', 'res_print', false);return false;
  505. <?php
  506.      }
  507.      else if ($export_ajax == 'D') {
  508. ?>
  509.          parent.nm_gp_print_conf(opc, cor, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', 'det_print', false);return false;
  510. <?php
  511.      } else {
  512. ?>
  513.          parent.nm_gp_print_conf(opc, cor, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', '', false);return false;
  514. <?php
  515.      }
  516. ?>
  517. /*--------*/

  518.     $('#bsair').click();

  519.   }
  520. </script>
  521. <script>
  522.         //colocado aqui devido a execução modal não executar o ready do jquery
  523.       setTimeout("ajusta_window()", 50);
  524. </script>
  525. </body>
  526. </html>
Return
grid_new_config_word.php
  1. <?php
  2. /**
  3.  * $Id: nm_gp_config_word.php,v 1.2 2012-01-27 13:02:59 sergio Exp $
  4.  */
  5.     include_once('grid_new_session.php');
  6.     session_start();
  7.     $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  8.     //check tmp
  9.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  10.     {
  11.         $str_path_apl_url $_SERVER['PHP_SELF'];
  12.         $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  13.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  14.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  15.         /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  16.     }
  17.     $SC_cod_proj "Projeto7";
  18.     $SC_apl_proc "grid_new";
  19.     $SC_conf_opt explode(",","tem_res_cons,tem_res_res,cor");
  20. /* sc_apl_default */
  21.     if (!isset($_SESSION['sc_session']))
  22.     {
  23.         $NM_dir_atual getcwd();
  24.         if (empty($NM_dir_atual))
  25.         {
  26.             $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  27.             $str_path_sys  str_replace("\\"'/'$str_path_sys);
  28.         }
  29.         else
  30.         {
  31.             $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  32.             $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  33.         }
  34.         $str_path_web    $_SERVER['PHP_SELF'];
  35.         $str_path_web    str_replace("\\"'/'$str_path_web);
  36.         $str_path_web    str_replace('//''/'$str_path_web);
  37.         $root            substr($str_path_sys0, -strlen($str_path_web));
  38.         if (is_file($root $_SESSION['scriptcase'][$SC_apl_proc]['glo_nm_path_imag_temp'] . "/sc_apl_default_" $SC_cod_proj ".txt"))
  39.         {
  40. ?>
  41.             <script language="javascript">
  42.                parent.nm_move();
  43.             </script>
  44. <?php
  45.         exit;
  46.         }
  47.     }
  48.     $language    = (isset($_GET['language'])) ? $_GET['language'] : "port";
  49.     $res_cons    = (isset($_GET['nm_res_cons']))    ? $_GET['nm_res_cons']    : "n";
  50.     $origem      = (isset($_GET['origem']))         ? $_GET['origem']         : "cons";
  51.     $password    = (isset($_GET['password'])) ? $_GET['password'] : "s";
  52.     $ini_word_res explode(","$_GET['nm_ini_word_res']);
  53.     $all_modules explode(","$_GET['nm_all_modules']);
  54. /*--- exportacoes ajax */
  55.     $export_ajax = (isset($_GET['export_ajax'])) ? $_GET['export_ajax'] : 'N';
  56. /*--------*/
  57.     $script_case_init = (isset($_GET['script_case_init'])) ? filter_input(INPUT_GET'script_case_init'FILTER_SANITIZE_NUMBER_INT) : 'N';
  58.     $hasSelColumns= (isset($_GET['summary_export_columns']))  ? 'S' == filter_input(INPUT_GET'summary_export_columns'FILTER_SANITIZE_STRING) : false;
  59.     if (isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'])) {
  60.         foreach ($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'] as $ind => $cada_cmp) {
  61.             if (!isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['labels'][$cada_cmp])) {
  62.                $hasSelColumns false;
  63.             }
  64.         }
  65.     }
  66.     else {
  67.          $hasSelColumns false;
  68.     }
  69. /*
  70.     if (!in_array("campos_sel", $SC_conf_opt)) {
  71.         $hasSelColumns = false;
  72.     }
  73. */
  74.     ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  75.     if (!function_exists("NM_is_utf8"))
  76.     {
  77.         include_once("../_lib/lib/php/nm_utf8.php");
  78.     }

  79.     $tradutor = array();
  80.     if (isset($_SESSION['scriptcase']['sc_idioma_word']))
  81.     {
  82.         $tradutor $_SESSION['scriptcase']['sc_idioma_word'];
  83.     }
  84.     if (!isset($tradutor[$language]))
  85.     {
  86.         foreach ($tradutor as $language => $resto)
  87.         {
  88.             break;
  89.         }
  90.     }
  91.     if (!isset($tradutor[$language]))
  92.     {
  93.                 exit;
  94.     }

  95. ?>
  96. <html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  97. <head>
  98.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html']; ?>" />
  99. <?php
  100. if ($_SESSION['scriptcase']['proc_mobile'])
  101. {
  102. ?>
  103.  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  104. <?php
  105. }
  106. ?>
  107.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" />
  108.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" />
  109.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab'?>" />
  110.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab_dir'?>" />
  111.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div'?>" />
  112.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div_dir'?>" />
  113.  <?php
  114.   if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  115.   {
  116.     ?>
  117.     <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts']; ?>" />
  118.     <?php
  119.   }
  120.  ?>
  121.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" />
  122.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/css/smoothness/jquery-ui.css" />
  123.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" />
  124. </head>
  125. <body class="scGridPage" style="margin: 0px; overflow-x: hidden">

  126. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  127. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery-ui.js"></script>
  128. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>

  129. <form name="config_prt" method="post" action="" autocomplete="off">
  130. <?php
  131. $pos "left";
  132. if ($_SESSION['scriptcase']['reg_conf']['html_dir'] == " DIR='RTL'")
  133. {
  134.     $pos "right";
  135. }
  136. ?>
  137. <table id="main_table" class="exportConfig" style="position: relative; top: 20px; <?php echo $pos?>: 20px">
  138. <tr>
  139.  <td align="center">

  140.   <div id="tabs">
  141.     <ul class="scAppDivTabLine" style="display:<?php echo ($hasSelColumns)?"":"none"?>">
  142.       <li class="scTabActive"><a href="#tabs-general"><?php echo $tradutor[$language]['titulo']; ?></a></li>
  143.       <li class="scTabInactive"><a href="#tabs-sel-columns"><?php echo $tradutor[$language]['titulo_colunas']; ?></a></li>
  144.     </ul>
  145.     <div id="tabs-general" style="padding: 0px; margin: 0px">

  146.       <table class="scGridBorder" width='100%' cellspacing="0" cellpadding="0">
  147.           <tr style="display:<?php echo ($hasSelColumns)?"none":""?>">
  148.             <td colspan=2 class="scGridLabelVert"><?php echo $tradutor[$language]['titulo']; ?></td>
  149.           </tr>
  150.           <tr><td nowrap class='scGridToolbar' colspan=2 style='font-weight: bold;'><?php echo $tradutor[$language]['group_general']; ?></td></tr>


  151.       <?php
  152.       if ($res_cons == "s" && $origem != "chart")
  153.       {
  154.           $Opt_display = (($origem == 'cons' && !in_array("tem_res_cons"$SC_conf_opt)) || ($origem == 'res' && !in_array("tem_res_res"$SC_conf_opt))) ? true false;
  155.       ?>
  156.        <tr<?php echo $Opt_display ?>>
  157.          <td nowrap class="scGridFieldOddFont" align="left">
  158.              <?php echo $tradutor[$language]['modules']; ?>
  159.          </td>
  160.          <td nowrap class="scGridFieldOddFont" align="left">
  161.           <div class="input-group input-group-horizontal">
  162.           <?php
  163.              foreach ($all_modules as $cada_mod)
  164.              {
  165.                  if ($cada_mod != 'chart')
  166.                  {
  167.                      $ckeck = (in_array($cada_mod$ini_word_res)) ? "checked" "";
  168.                  ?>
  169.                     <label>
  170.                     <input type=checkbox id="id_tem_res_cons" name="tem_res_cons[]"  <?php echo $ckeck ?> value="<?php echo $cada_mod ?>"><?php echo $tradutor[$language]['mod_' $cada_mod]; ?>
  171.                      </label>

  172.                  <?php
  173.                  }
  174.              }
  175.           ?>
  176.         </div>
  177.          </td>
  178.       </tr>
  179.       <?php
  180.       }
  181.          $Opt_display = (!in_array("cor"$SC_conf_opt)) ? ' style="display: none"' '';
  182.      ?>
  183.            <tr<?php echo $Opt_display ?>>
  184.              <td nowrap class="scGridFieldOddFont" align="left">
  185.                  <?php echo $tradutor[$language]['cor']; ?>
  186.              </td>
  187.              <td nowrap class="scGridFieldOddFont" align="left">
  188.               <div class="input-group input-group-vertical">
  189.                <label><input type=radio name="cor" value="pb" checked><?php echo $tradutor[$language]['pb']; ?></label>
  190.                <label><input type=radio name="cor" value="co"><?php echo $tradutor[$language]['color']; ?></label>
  191.              </div>
  192.              </td>
  193.           </tr>

  194.      <?php
  195.       if ($password == "s")
  196.       {
  197. /*         $Opt_display = (!in_array("password", $SC_conf_opt)) ? ' style="display: none"' : ''; */
  198.          $Opt_display = (!in_array("password"$SC_conf_opt)) ? '' '';
  199.       ?>
  200.        <tr<?php echo $Opt_display ?>>
  201.          <td nowrap class="scGridFieldOddFont" align="left">
  202.              <?php echo $tradutor[$language]['password']; ?>
  203.          </td>
  204.          <td nowrap class="scGridFieldOddFont" align="left">
  205.            <input type=password name="password" value="" size=30> </td>
  206.       </tr>
  207.       <?php
  208.       }
  209.       ?>

  210.       </table>
  211.     </div>
  212.     <div id="tabs-sel-columns" style="padding: 0px; margin: 0px; display:none;">

  213.         <?php
  214.         if($hasSelColumns)
  215.         {
  216.           $bol_sel_campos_include true;
  217.           if(!isset($app_name))
  218.           {
  219.             $app_name $SC_apl_proc;
  220.           }
  221.           include($app_name "_sel_campos.php");
  222.           $class_name = (is_numeric(substr($app_name01))) ? "_" $app_name $app_name;
  223.           $sel_campos $class_name "_sel_cmp";
  224.           $sel_campos = new $sel_campos($bol_sel_campos_include$script_case_init);
  225.           $sel_campos->Sel_cmp_init();
  226.           $sel_campos->Sel_cmp_init_fields();
  227.           $sel_campos->displayHtml(false);
  228.         }
  229.         ?>

  230.     </div>
  231.   </div>
  232.   <div class="buttons">
  233.     <?php
  234.     echo  $_SESSION['scriptcase']['bg_btn_popup']['bok'];
  235.     echo  "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  236.     echo  $_SESSION['scriptcase']['bg_btn_popup']['btbremove'];
  237.     ?>
  238.   </div>

  239.  </td>
  240.  </tr>
  241. </table>
  242. </form>


  243. <script language="javascript">
  244. var bFixed = false;
  245. function ajusta_window()
  246. {
  247.   var mt   = $(document.getElementById("main_table"));
  248.   var mt1  = $(document.getElementById("tabs-general"));
  249.   altura  = mt1.height();
  250.   largura = mt1.width();
  251.   if($('#tabs-sel-columns').length > 0)
  252.   {
  253.     mt2  = $(document.getElementById("tabs-sel-columns"));
  254.     if(mt2.height() > altura)
  255.     {
  256.       altura = mt2.height();
  257.     }
  258.     if(mt2.width() > largura)
  259.     {
  260.       largura = mt2.width();
  261.     }
  262.   }

  263.   //protect against max windows
  264.   if((altura + 220) > parent.window.innerHeight) altura = parent.window.innerHeight - 220;

  265.   if (0 == largura || 0 == altura)
  266.   {
  267.     setTimeout("ajusta_window()", 50);
  268.     return;
  269.   }
  270.   else if(!bFixed)
  271.   {
  272.     bFixed = true;
  273.     if (navigator.userAgent.indexOf("Chrome/") > 0)
  274.     {
  275.       self.parent.tb_resize(altura + 150, largura + 40);
  276.       setTimeout("ajusta_window()", 50);
  277.       return;
  278.     }
  279.   }
  280.   mt.width( largura );
  281.   self.parent.tb_resize(altura + 150, largura + 40);
  282. }

  283. $('#tabs > ul > li').click(function() {
  284.   if($(this).find("a").length)
  285.   {
  286.     $('#tabs > ul > li').removeClass("scTabActive");
  287.     $('#tabs > ul > li').addClass("scTabInactive");

  288.     $(this).removeClass("scTabInactive");
  289.     $(this).addClass("scTabActive");

  290.     $('#tabs > div').hide();
  291.     $($(this).find("a").attr("href")).show();
  292.   }
  293. });
  294. $( document ).ready(function() {
  295.    setTimeout("ajusta_window();$('#tabs > ul > li:first-child').click();", 50);
  296. <?php
  297.   if ($password == "s")
  298.   {
  299. ?>
  300.    document.config_prt.password.value = "";
  301. <?php
  302.   }
  303. ?>
  304. });

  305.   function scSubmitSelCamposAjaxExportDone()
  306.   {
  307.     saveSelColumns = true;
  308.     processa();
  309.   }

  310.   var saveSelColumns = false;
  311.   function processa()
  312.   {
  313.      <?php
  314.      if($hasSelColumns)
  315.      {
  316.       ?>
  317.       if(saveSelColumns == false)
  318.       {
  319.         scSubmitSelCamposAjaxExport();
  320.         return false;
  321.       }
  322.       <?php
  323.      }
  324.      ?>

  325.      <?php
  326.      if($export_ajax != "S" && $export_ajax != "R")
  327.      {
  328.       ?>
  329.       self.parent.tb_remove();
  330.       <?php
  331.      }
  332.      ?>
  333.      cor = (document.config_prt.cor[0].checked) ? "pb" : "co";

  334.      res_cons = "";
  335.      if (document.config_prt.id_tem_res_cons)
  336.      {
  337.          Nobj = document.getElementById('id_tem_res_cons').name;
  338.          obj  = document.getElementsByName(Nobj);
  339.          for (iCheck = 0; iCheck < obj.length; iCheck++) {
  340.               if (obj[iCheck].checked) {
  341.                   if (res_cons != "") {
  342.                      res_cons += ",";
  343.                   }
  344.                   res_cons += obj[iCheck].value;
  345.               }
  346.          }
  347.      }
  348.      else
  349.      {
  350.          res_cons = "<?php if ($origem == "cons") {echo "grid";} else {echo "resume";} ?>";
  351.      }
  352.      if (res_cons == "")
  353.      {
  354.         return;
  355.      }

  356.      use_pass = "";
  357.      <?php
  358.      if($password == "s")
  359.      {
  360.       ?>
  361.          use_pass = document.config_prt.password.value;
  362.       <?php
  363.      }
  364.      ?>



  365. /*--- exportacoes ajax */
  366. /*     parent.nm_gp_word_conf(cor);return false; */
  367. <?php
  368.      if ($export_ajax == 'S') {
  369. ?>
  370.      parent.nm_gp_word_conf(cor, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', 'doc_word', false);return false;
  371. <?php
  372.      }
  373.      else if ($export_ajax == 'R') {
  374. ?>
  375.      parent.nm_gp_word_conf(cor, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', 'doc_word_res', false);return false;
  376. <?php

  377.      } else {
  378. ?>
  379.      parent.nm_gp_word_conf(cor, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', '', false);return false;
  380. <?php
  381.      }
  382. ?>
  383. /*--------*/

  384.     $('#bsair').click();
  385.   }
  386. </script>
  387. <script>
  388.         //colocado aqui devido a execução modal não executar o ready do jquery
  389.      setTimeout("ajusta_window()", 50);
  390. </script>
  391. </body>
  392. </html>
Return
grid_new_config_xls.php
  1. <?php
  2. /**
  3.  * $Id: nm_gp_config_xls.php,v 1.2 2018-11-12 13:02:59 sergio Exp $
  4.  */
  5.     include_once('grid_new_session.php');
  6.     session_start();
  7.     $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  8.     //check tmp
  9.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  10.     {
  11.         $str_path_apl_url $_SERVER['PHP_SELF'];
  12.         $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  13.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  14.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  15.         /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  16.     }
  17.     $SC_cod_proj "Projeto7";
  18.     $SC_apl_proc "grid_new";
  19.     $SC_conf_opt explode(",","tem_res_cons,tem_res_res,tp_xls");
  20. /* sc_apl_default */
  21.     if (!isset($_SESSION['sc_session']))
  22.     {
  23.         $NM_dir_atual getcwd();
  24.         if (empty($NM_dir_atual))
  25.         {
  26.             $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  27.             $str_path_sys  str_replace("\\"'/'$str_path_sys);
  28.         }
  29.         else
  30.         {
  31.             $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  32.             $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  33.         }
  34.         $str_path_web    $_SERVER['PHP_SELF'];
  35.         $str_path_web    str_replace("\\"'/'$str_path_web);
  36.         $str_path_web    str_replace('//''/'$str_path_web);
  37.         $root            substr($str_path_sys0, -strlen($str_path_web));
  38.         if (is_file($root $_SESSION['scriptcase'][$SC_apl_proc]['glo_nm_path_imag_temp'] . "/sc_apl_default_" $SC_cod_proj ".txt"))
  39.         {
  40. ?>
  41.             <script language="javascript">
  42.                parent.nm_move();
  43.             </script>
  44. <?php
  45.             exit;
  46.         }
  47.     }
  48.     $tp_xls      = (isset($_GET['nm_tp_xls']))      ? $_GET['nm_tp_xls']      : "xlsx";
  49.     $tot_xls     = (isset($_GET['nm_tot_xls']))     ? $_GET['nm_tot_xls']     : "N";
  50.     $res_cons    = (isset($_GET['nm_res_cons']))    ? $_GET['nm_res_cons']    : "n";
  51.     $origem      = (isset($_GET['origem']))         ? $_GET['origem']         : "cons";
  52.     $language    = (isset($_GET['language']))       ? $_GET['language']       : "port";
  53.     $password    = (isset($_GET['password']))       ? $_GET['password']       : "s";
  54.     $ini_xls_res  explode(","$_GET['nm_ini_xls_res']);
  55.     $all_modules  explode(","$_GET['nm_all_modules']);
  56.     $script_case_init = (isset($_GET['script_case_init'])) ? filter_input(INPUT_GET'script_case_init'FILTER_SANITIZE_NUMBER_INT) : 'N';
  57.     $app_name     = (isset($_GET['app_name']))      ? filter_input(INPUT_GET'app_name'FILTER_SANITIZE_STRING) : 'N';
  58.     $hasSelColumns= (isset($_GET['summary_export_columns']))  ? 'S' == filter_input(INPUT_GET'summary_export_columns'FILTER_SANITIZE_STRING) : false;
  59.     if (isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'])) {
  60.         foreach ($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'] as $ind => $cada_cmp) {
  61.             if (!isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['labels'][$cada_cmp])) {
  62.                $hasSelColumns false;
  63.             }
  64.         }
  65.     }
  66.     else {
  67.          $hasSelColumns false;
  68.     }
  69. /*
  70.     if (!in_array("campos_sel", $SC_conf_opt)) {
  71.         $hasSelColumns = false;
  72.     }
  73. */
  74.     if ($tp_xls == "both")
  75.     {
  76.         $tp_xls "xlsx";
  77.     }
  78. /*--- exportacoes ajax */
  79.     $export_ajax = (isset($_GET['export_ajax'])) ? $_GET['export_ajax'] : 'N';
  80. /*--------*/

  81.     ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  82.     if (!function_exists("NM_is_utf8"))
  83.     {
  84.         include_once("../_lib/lib/php/nm_utf8.php");
  85.     }

  86.     $tradutor = array();
  87.     if (isset($_SESSION['scriptcase']['sc_idioma_xls']))
  88.     {
  89.         $tradutor $_SESSION['scriptcase']['sc_idioma_xls'];
  90.     }
  91.     if (!isset($tradutor[$language]))
  92.     {
  93.         foreach ($tradutor as $language => $resto)
  94.         {
  95.             break;
  96.         }
  97.     }
  98.     if (!isset($tradutor[$language]))
  99.     {
  100.         exit;
  101.     }

  102. ?>
  103. <html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  104. <head>
  105.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html']; ?>" />
  106. <?php
  107. if ((isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])  || (isset($_SESSION['scriptcase']['device_mobile']) && $_SESSION['scriptcase']['device_mobile'] && $_SESSION['scriptcase']['display_mobile']))
  108. {
  109. ?>
  110.  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  111. <?php
  112. }
  113. ?>
  114.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" />
  115.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" />
  116.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab'?>" />
  117.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab_dir'?>" />
  118.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div'?>" />
  119.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div_dir'?>" />
  120.  <?php
  121.   if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  122.   {
  123.     ?>
  124.     <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts']; ?>" />
  125.     <?php
  126.   }
  127.  ?>
  128.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" />
  129.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/css/smoothness/jquery-ui.css" />
  130.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" />
  131. </head>
  132. <body class="scGridPage" style="margin: 0px; overflow-x: hidden">

  133. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  134. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery-ui.js"></script>
  135. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>

  136. <form name="config_xls" method="post" action="" autocomplete="off">

  137. <?php
  138. $pos "left";
  139. if ($_SESSION['scriptcase']['reg_conf']['html_dir'] == " DIR='RTL'")
  140. {
  141.     $pos "right";
  142. }
  143. ?>
  144. <table id="main_table" class="exportConfig" style="position: relative; top: 20px; <?php echo $pos?>: 20px">
  145. <tr>
  146.  <td align="center">

  147.   <div id="tabs">
  148.     <ul class="scAppDivTabLine" style="display:<?php echo ($hasSelColumns)?"":"none"?>">
  149.       <li class="scTabActive"><a href="#tabs-general"><?php echo $tradutor[$language]['titulo']; ?></a></li>
  150.       <li class="scTabInactive"><a href="#tabs-sel-columns"><?php echo $tradutor[$language]['titulo_colunas']; ?></a></li>
  151.     </ul>
  152.     <div id="tabs-general" style="padding: 0px; margin: 0px">
  153.        <table class="scGridBorder" width='100%' cellspacing="0" cellpadding="0">
  154.           <tr style="display:<?php echo ($hasSelColumns)?"none":""?>">
  155.             <td colspan=2 class="scGridLabelVert"><?php echo $tradutor[$language]['titulo']; ?></td>
  156.           </tr>
  157.           <tr><td nowrap class='scGridToolbar' colspan=2 style='font-weight: bold;'><?php echo $tradutor[$language]['group_general']; ?></td></tr>

  158.       <?php
  159.       if ($res_cons == "s" && $origem != "chart")
  160.       {
  161.           $Opt_display = (($origem == 'cons' && !in_array("tem_res_cons"$SC_conf_opt)) || ($origem == 'res' && !in_array("tem_res_res"$SC_conf_opt))) ? true false;
  162.       ?>
  163.        <tr<?php echo $Opt_display ?>>
  164.          <td nowrap class="scGridFieldOddFont" align="left">
  165.              <?php echo $tradutor[$language]['modules']; ?>
  166.          </td>
  167.          <td nowrap class="scGridFieldOddFont" align="left">
  168.           <div class="input-group input-group-horizontal">
  169.           <?php
  170.              foreach ($all_modules as $cada_mod)
  171.              {
  172.                  if ($cada_mod != 'chart')
  173.                  {
  174.                      $ckeck = (in_array($cada_mod$ini_xls_res)) ? "checked" "";
  175.                  ?>
  176.                     <label>
  177.                     <input type=checkbox id="id_tem_res_cons" name="tem_res_cons[]"  <?php echo $ckeck ?> value="<?php echo $cada_mod ?>"><?php echo $tradutor[$language]['mod_' $cada_mod]; ?>
  178.                      </label>

  179.                  <?php
  180.                  }
  181.              }
  182.           ?>
  183.         </div>
  184.          </td>
  185.       </tr>
  186.       <?php
  187.       }

  188.         $Opt_display = (!in_array("tp_xls"$SC_conf_opt)) ? ' style="display: none"' '';
  189.      ?>
  190.       <tr<?php echo $Opt_display ?>>
  191.          <td nowrap class="scGridFieldOddFont" align="left">
  192.              <?php echo $tradutor[$language]['tp_xls']; ?>
  193.          </td>
  194.          <td nowrap class="scGridFieldOddFont" align="left">
  195.           <div class="input-group input-group-vertical">
  196.       <?php
  197.          $ckeck = ($tp_xls == "xls") ? "checked" "";
  198.       ?>
  199.             <label><input type=radio name="tp_xls" value="xls" <?php echo $ckeck ?>> .xls</label>
  200.       <?php
  201.          $ckeck = ($tp_xls == "xlsx") ? "checked" "";
  202.       ?>
  203.             <label><input type=radio name="tp_xls" value="xlsx" <?php echo $ckeck ?>> .xlsx</label>
  204.           </div>
  205.          </td>
  206.        </tr>

  207.      <?php
  208.         $Opt_display = (!in_array("xls_totals"$SC_conf_opt) || !in_array("grid"$all_modules)) ? ' style="display: none"' '';
  209.      ?>
  210.       <tr<?php echo $Opt_display ?>>
  211.          <td nowrap class="scGridFieldOddFont" align="left">
  212.              <?php echo $tradutor[$language]['tot_xls']; ?>
  213.          </td>
  214.          <td nowrap class="scGridFieldOddFont" align="left">
  215.           <div class="input-group input-group-vertical">
  216.       <?php
  217.          $ckeck = ($tot_xls == "S") ? "checked" "";
  218.       ?>
  219.             <label><input type=checkbox name="tot_xls" value="S" <?php echo $ckeck ?>></label>
  220.           </div>
  221.          </td>
  222.        </tr>


  223.      <?php
  224.       if ($password == "s")
  225.       {
  226. /*         $Opt_display = (!in_array("password", $SC_conf_opt)) ? ' style="display: none"' : ''; */
  227.          $Opt_display = (!in_array("password"$SC_conf_opt)) ? '' '';
  228.       ?>
  229.        <tr<?php echo $Opt_display ?>>
  230.          <td nowrap class="scGridFieldOddFont" align="left">
  231.              <?php echo $tradutor[$language]['password']; ?>
  232.          </td>
  233.          <td nowrap class="scGridFieldOddFont" align="left">
  234.            <input type=password name="password" value="" size=30> </td>
  235.        </tr>
  236.       <?php
  237.       }
  238.       ?>
  239.       </table>
  240.     </div>
  241.     <div id="tabs-sel-columns" style="padding: 0px; margin: 0px; display:none;">

  242.         <?php
  243.         if($hasSelColumns)
  244.         {
  245.           $bol_sel_campos_include true;
  246.           include($app_name "_sel_campos.php");
  247.           $class_name = (is_numeric(substr($app_name01))) ? "_" $app_name $app_name;
  248.           $sel_campos $class_name "_sel_cmp";
  249.           $sel_campos = new $sel_campos($bol_sel_campos_include$script_case_init);
  250.           $sel_campos->Sel_cmp_init();
  251.           $sel_campos->Sel_cmp_init_fields();
  252.           $sel_campos->displayHtml(false);
  253.         }
  254.         ?>

  255.     </div>
  256.   </div>
  257.   <div class="buttons">
  258.     <?php
  259.     echo  $_SESSION['scriptcase']['bg_btn_popup']['bok'];
  260.     echo  "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  261.     echo  $_SESSION['scriptcase']['bg_btn_popup']['btbremove'];
  262.     ?>
  263.   </div>

  264.  </td>
  265.  </tr>
  266. </table>

  267. </form>


  268. <script language="javascript">
  269. var bFixed = false;
  270. function ajusta_window()
  271. {
  272.   var mt   = $(document.getElementById("main_table"));
  273.   var mt1  = $(document.getElementById("tabs-general"));
  274.   altura  = mt1.height();
  275.   largura = mt1.width();
  276.   if($('#tabs-sel-columns').length > 0)
  277.   {
  278.     mt2  = $(document.getElementById("tabs-sel-columns"));
  279.     if(mt2.height() > altura)
  280.     {
  281.       altura = mt2.height();
  282.     }
  283.     if(mt2.width() > largura)
  284.     {
  285.       largura = mt2.width();
  286.     }
  287.   }

  288.   //protect against max windows
  289.   if((altura + 220) > parent.window.innerHeight) altura = parent.window.innerHeight - 220;

  290.   if (0 == largura || 0 == altura)
  291.   {
  292.     setTimeout("ajusta_window()", 50);
  293.     return;
  294.   }
  295.   else if(!bFixed)
  296.   {
  297.     bFixed = true;
  298.     if (navigator.userAgent.indexOf("Chrome/") > 0)
  299.     {
  300.       self.parent.tb_resize(altura + 150, largura + 40);
  301.       setTimeout("ajusta_window()", 50);
  302.       return;
  303.     }
  304.   }
  305.   mt.width( largura );
  306.   self.parent.tb_resize(altura + 150, largura + 40);
  307. }

  308. $('#tabs > ul > li').click(function() {
  309.   if($(this).find("a").length)
  310.   {
  311.     $('#tabs > ul > li').removeClass("scTabActive");
  312.     $('#tabs > ul > li').addClass("scTabInactive");

  313.     $(this).removeClass("scTabInactive");
  314.     $(this).addClass("scTabActive");

  315.     $('#tabs > div').hide();
  316.     $($(this).find("a").attr("href")).show();
  317.   }
  318. });
  319. $( document ).ready(function() {
  320.    setTimeout("ajusta_window();$('#tabs > ul > li:first-child').click();", 50);
  321. <?php
  322.   if ($password == "s")
  323.   {
  324. ?>
  325.    document.config_xls.password.value = "";
  326. <?php
  327.   }
  328. ?>
  329. });

  330.   function scSubmitSelCamposAjaxExportDone()
  331.   {
  332.     saveSelColumns = true;
  333.     processa();
  334.   }

  335.   var saveSelColumns = false;
  336.   function processa()
  337.   {
  338.      <?php
  339.      if($hasSelColumns)
  340.      {
  341.       ?>
  342.       if(saveSelColumns == false)
  343.       {
  344.         scSubmitSelCamposAjaxExport();
  345.         return false;
  346.       }
  347.       <?php
  348.      }
  349.      ?>

  350.      <?php
  351.      if($export_ajax != "S" && $export_ajax != "R" && $export_ajax != "D")
  352.      {
  353.       ?>
  354.       self.parent.tb_remove();
  355.       <?php
  356.      }
  357.      ?>

  358.      tp_xls   = document.config_xls.tp_xls.value;
  359.      if (document.config_xls.tot_xls.checked) {
  360.          tot_xls = "S";
  361.      }
  362.      else {
  363.          tot_xls = "N";
  364.      }
  365.      res_cons = "";
  366.      if (document.config_xls.id_tem_res_cons)
  367.      {
  368.          Nobj = document.getElementById('id_tem_res_cons').name;
  369.          obj  = document.getElementsByName(Nobj);
  370.          for (iCheck = 0; iCheck < obj.length; iCheck++) {
  371.               if (obj[iCheck].checked) {
  372.                   if (res_cons != "") {
  373.                      res_cons += ",";
  374.                   }
  375.                   res_cons += obj[iCheck].value;
  376.               }
  377.          }
  378.      }
  379.      else
  380.      {
  381.          res_cons = "<?php if ($origem == "cons") {echo "grid";} else {echo "resume";} ?>";
  382.      }
  383.      if (res_cons == "")
  384.      {
  385.         return;
  386.      }

  387.      use_pass = "";
  388.      <?php
  389.      if($password == "s")
  390.      {
  391.       ?>
  392.          use_pass = document.config_xls.password.value;
  393.       <?php
  394.      }
  395.      ?>

  396. /*--- exportacoes ajax */
  397. <?php
  398.      if ($export_ajax == 'S') {
  399. ?>
  400.          parent.nm_gp_xls_conf(tp_xls, res_cons, use_pass, tot_xls, '<?php echo NM_encode_input($export_ajax); ?>', 'xls', false);return false;
  401. <?php
  402.      }
  403.      else if ($export_ajax == 'R') {
  404. ?>
  405.          parent.nm_gp_xls_conf(tp_xls, res_cons, use_pass, tot_xls, '<?php echo NM_encode_input($export_ajax); ?>', 'xls_res', false);return false;
  406. <?php
  407.      } else {
  408. ?>
  409.          parent.nm_gp_xls_conf(tp_xls, res_cons, use_pass, tot_xls, '<?php echo NM_encode_input($export_ajax); ?>', '', false);return false;
  410. <?php
  411.      }
  412. ?>
  413. /*--------*/

  414.     $('#bsair').click();

  415.   }
  416. </script>
  417. <script>
  418.         //colocado aqui devido a execução modal não executar o ready do jquery
  419.       setTimeout("ajusta_window()", 50);
  420. </script>
  421. </body>
  422. </html>
Return
grid_new_config_xml.php
  1. <?php
  2. /**
  3.  * $Id: nm_gp_config_xml.php,v 1.2 2018-11-16 13:02:59 sergio Exp $
  4.  */
  5.     include_once('grid_new_session.php');
  6.     session_start();
  7.     $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  8.     //check tmp
  9.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  10.     {
  11.         $str_path_apl_url $_SERVER['PHP_SELF'];
  12.         $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  13.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  14.         $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  15.         /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  16.     }
  17.     $SC_cod_proj "Projeto7";
  18.     $SC_apl_proc "grid_new";
  19.     $SC_conf_opt explode(",","tem_res_cons,tem_res_res,nm_xml_tag,nm_xml_label");
  20. /* sc_apl_default */
  21.     if (!isset($_SESSION['sc_session']))
  22.     {
  23.         $NM_dir_atual getcwd();
  24.         if (empty($NM_dir_atual))
  25.         {
  26.             $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  27.             $str_path_sys  str_replace("\\"'/'$str_path_sys);
  28.         }
  29.         else
  30.         {
  31.             $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  32.             $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  33.         }
  34.         $str_path_web    $_SERVER['PHP_SELF'];
  35.         $str_path_web    str_replace("\\"'/'$str_path_web);
  36.         $str_path_web    str_replace('//''/'$str_path_web);
  37.         $root            substr($str_path_sys0, -strlen($str_path_web));
  38.         if (is_file($root $_SESSION['scriptcase'][$SC_apl_proc]['glo_nm_path_imag_temp'] . "/sc_apl_default_" $SC_cod_proj ".txt"))
  39.         {
  40. ?>
  41.             <script language="javascript">
  42.                parent.nm_move();
  43.             </script>
  44. <?php
  45.             exit;
  46.         }
  47.     }

  48.     $xml_tag     = (isset($_GET['nm_xml_tag']))   ? $_GET['nm_xml_tag']    : "tag";
  49.     $xml_label   = (isset($_GET['nm_xml_label'])) ? $_GET['nm_xml_label']  : "N";
  50.     $language    = (isset($_GET['language']))     ? $_GET['language']      : "port";
  51.     $origem      = (isset($_GET['origem']))         ? $_GET['origem']      : "cons";
  52.     $res_cons    = (isset($_GET['nm_res_cons']))    ? $_GET['nm_res_cons'] : "n";
  53.     $password    = (isset($_GET['password']))       ? $_GET['password']    : "s";
  54.     $ini_xml_res  explode(","$_GET['nm_ini_xml_res']);
  55.     $all_modules  explode(","$_GET['nm_all_modules']);
  56. /*--- exportacoes ajax */
  57.     $export_ajax = (isset($_GET['export_ajax']))  ? $_GET['export_ajax']   : 'N';
  58. /*--------*/
  59.     $script_case_init = (isset($_GET['script_case_init'])) ? filter_input(INPUT_GET'script_case_init'FILTER_SANITIZE_NUMBER_INT) : 'N';
  60.     $hasSelColumns= (isset($_GET['summary_export_columns']))  ? 'S' == filter_input(INPUT_GET'summary_export_columns'FILTER_SANITIZE_STRING) : false;
  61.     if (isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'])) {
  62.         foreach ($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['field_order'] as $ind => $cada_cmp) {
  63.             if (!isset($_SESSION['sc_session'][$script_case_init][$SC_apl_proc]['labels'][$cada_cmp])) {
  64.                $hasSelColumns false;
  65.             }
  66.         }
  67.     }
  68.     else {
  69.          $hasSelColumns false;
  70.     }
  71. /*
  72.     if (!in_array("campos_sel", $SC_conf_opt)) {
  73.         $hasSelColumns = false;
  74.     }
  75. */
  76.     ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  77.     if (!function_exists("NM_is_utf8"))
  78.     {
  79.         include_once("../_lib/lib/php/nm_utf8.php");
  80.     }

  81.     $tradutor = array();
  82.     if (isset($_SESSION['scriptcase']['sc_idioma_xml']))
  83.     {
  84.         $tradutor $_SESSION['scriptcase']['sc_idioma_xml'];
  85.     }
  86.     if (!isset($tradutor[$language]))
  87.     {
  88.         foreach ($tradutor as $language => $resto)
  89.         {
  90.             break;
  91.         }
  92.     }
  93.     if (!isset($tradutor[$language]))
  94.     {
  95.        exit;
  96.     }

  97. ?>
  98. <html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  99. <head>
  100.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html']; ?>" />
  101. <?php
  102. if ((isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])  || (isset($_SESSION['scriptcase']['device_mobile']) && $_SESSION['scriptcase']['device_mobile'] && $_SESSION['scriptcase']['display_mobile']))
  103. {
  104. ?>
  105.  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  106. <?php
  107. }
  108. ?>
  109. <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" />
  110.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" />
  111.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab'?>" />
  112.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_tab_dir'?>" />
  113.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div'?>" />
  114.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div_dir'?>" />
  115.  <?php
  116.   if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  117.   {
  118.     ?>
  119.     <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts']; ?>" />
  120.     <?php
  121.   }
  122.  ?>
  123.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" />
  124.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/css/smoothness/jquery-ui.css" />
  125.  <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" />
  126. </head>
  127. <body class="scGridPage" style="margin: 0px; overflow-x: hidden">

  128. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  129. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery-ui.js"></script>
  130. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>

  131. <form name="config_xml" method="post" action="" autocomplete="off">
  132. <?php
  133. $pos "left";
  134. if ($_SESSION['scriptcase']['reg_conf']['html_dir'] == " DIR='RTL'")
  135. {
  136.     $pos "right";
  137. }
  138. ?>
  139. <table id="main_table" class="exportConfig" style="position: relative; top: 20px; <?php echo $pos?>: 20px">
  140. <tr>
  141.  <td align="center">

  142.   <div id="tabs">
  143.     <ul class="scAppDivTabLine" style="display:<?php echo ($hasSelColumns)?"":"none"?>">
  144.       <li class="scTabActive"><a href="#tabs-general"><?php echo $tradutor[$language]['titulo']; ?></a></li>
  145.       <li class="scTabInactive"><a href="#tabs-sel-columns"><?php echo $tradutor[$language]['titulo_colunas']; ?></a></li>
  146.     </ul>
  147.     <div id="tabs-general" style="padding: 0px; margin: 0px">

  148.       <table class="scGridBorder" width='100%' cellspacing="0" cellpadding="0">
  149.           <tr style="display:<?php echo ($hasSelColumns)?"none":""?>">
  150.             <td colspan=2 class="scGridLabelVert"><?php echo $tradutor[$language]['titulo']; ?></td>
  151.           </tr>
  152.           <tr><td nowrap class='scGridToolbar' colspan=2 style='font-weight: bold;'><?php echo $tradutor[$language]['group_general']; ?></td></tr>

  153.       <?php
  154.       if ($res_cons == "s" && $origem != "chart")
  155.       {
  156.           $Opt_display = (($origem == 'cons' && !in_array("tem_res_cons"$SC_conf_opt)) || ($origem == 'res' && !in_array("tem_res_res"$SC_conf_opt))) ? true false;
  157.       ?>
  158.        <tr<?php echo $Opt_display ?>>
  159.          <td nowrap class="scGridFieldOddFont" align="left">
  160.              <?php echo $tradutor[$language]['modules']; ?>
  161.          </td>
  162.          <td nowrap class="scGridFieldOddFont" align="left">
  163.           <div class="input-group input-group-horizontal">
  164.           <?php
  165.              foreach ($all_modules as $cada_mod)
  166.              {
  167.                  if ($cada_mod != 'chart')
  168.                  {
  169.                      $ckeck = (in_array($cada_mod$ini_xml_res)) ? "checked" "";
  170.                  ?>
  171.                     <label>
  172.                     <input type=checkbox id="id_tem_res_cons" name="tem_res_cons[]"  <?php echo $ckeck ?> value="<?php echo $cada_mod ?>"><?php echo $tradutor[$language]['mod_' $cada_mod]; ?>
  173.                      </label>

  174.                  <?php
  175.                  }
  176.              }
  177.           ?>
  178.         </div>
  179.          </td>
  180.       </tr>
  181.       <?php
  182.       }
  183.         $Opt_display = (!in_array("nm_xml_tag"$SC_conf_opt)) ? ' style="display: none"' '';
  184.       ?>
  185.          <tr<?php echo $Opt_display ?>>
  186.            <td nowrap class="scGridFieldOddFont" align="left">
  187.                <?php echo $tradutor[$language]['xml_format']; ?>
  188.            </td>
  189.            <td nowrap class="scGridFieldOddFont" align="left">
  190.             <div class="input-group input-group-vertical">
  191.        <?php
  192.            $ckeck = ($xml_tag == "tag") ? "checked" "";
  193.         ?>
  194.              <label><input type=radio name="nm_xml_tag" value="tag" <?php echo $ckeck ?><?php echo $tradutor[$language]['xml_tag']; ?></label>
  195.         <?php
  196.            $ckeck = ($xml_tag == "attribute") ? "checked" "";
  197.         ?>
  198.              <label><input type=radio name="nm_xml_tag" value="attribute" <?php echo $ckeck ?><?php echo $tradutor[$language]['xml_attr']; ?></label>
  199.            </div>
  200.            </td>
  201.          </tr>

  202.       <?php
  203.         $Opt_display = (!in_array("nm_xml_label"$SC_conf_opt)) ? ' style="display: none"' '';
  204.       ?>
  205.          <tr<?php echo $Opt_display ?>>
  206.            <td nowrap class="scGridFieldOddFont" align="left">
  207.                <?php echo $tradutor[$language]['xml_label']; ?>
  208.            </td>
  209.            <td nowrap class="scGridFieldOddFont" align="left">
  210.             <div class="input-group input-group-vertical">
  211.        <?php
  212.            $ckeck = ($xml_label == "S") ? "checked" "";
  213.         ?>
  214.              <label><input type=radio name="nm_xml_label" value="S" <?php echo $ckeck ?><?php echo $tradutor[$language]['xml_yes']; ?></label>
  215.         <?php
  216.            $ckeck = ($xml_label == "N") ? "checked" "";
  217.         ?>
  218.              <label><input type=radio name="nm_xml_label" value="N" <?php echo $ckeck ?><?php echo $tradutor[$language]['xml_no']; ?></label>
  219.            </div>
  220.            </td>
  221.          </tr>
  222.      <?php
  223.       if ($password == "s")
  224.       {
  225. /*          $Opt_display = (!in_array("password", $SC_conf_opt)) ? ' style="display: none"' : ''; */
  226.           $Opt_display = (!in_array("password"$SC_conf_opt)) ? '' '';
  227.       ?>
  228.        <tr<?php echo $Opt_display ?>>
  229.          <td nowrap class="scGridFieldOddFont" align="left">
  230.              <?php echo $tradutor[$language]['password']; ?>
  231.          </td>
  232.          <td nowrap class="scGridFieldOddFont" align="left">
  233.            <input type=password name="password" value="" size=30> </td>
  234.       </tr>
  235.       <?php
  236.       }
  237.       ?>

  238.       </table>
  239.     </div>
  240.     <div id="tabs-sel-columns" style="padding: 0px; margin: 0px; display:none">

  241.         <?php
  242.         if($hasSelColumns)
  243.         {
  244.           $bol_sel_campos_include true;
  245.           if(!isset($app_name))
  246.           {
  247.             $app_name $SC_apl_proc;
  248.           }
  249.           include($app_name "_sel_campos.php");
  250.           $class_name = (is_numeric(substr($app_name01))) ? "_" $app_name $app_name;
  251.           $sel_campos $class_name "_sel_cmp";
  252.           $sel_campos = new $sel_campos($bol_sel_campos_include$script_case_init);
  253.           $sel_campos->Sel_cmp_init();
  254.           $sel_campos->Sel_cmp_init_fields();
  255.           $sel_campos->displayHtml(false);
  256.         }
  257.         ?>

  258.     </div>
  259.   </div>
  260.   <div class="buttons">
  261.     <?php
  262.     echo  $_SESSION['scriptcase']['bg_btn_popup']['bok'];
  263.     echo  "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  264.     echo  $_SESSION['scriptcase']['bg_btn_popup']['btbremove'];
  265.     ?>
  266.   </div>

  267.  </td>
  268.  </tr>
  269. </table>
  270. </form>


  271. <script language="javascript">
  272. var bFixed = false;
  273. function ajusta_window()
  274. {
  275.   var mt   = $(document.getElementById("main_table"));
  276.   var mt1  = $(document.getElementById("tabs-general"));
  277.   altura  = mt1.height();
  278.   largura = mt1.width();
  279.   if($('#tabs-sel-columns').length > 0)
  280.   {
  281.     mt2  = $(document.getElementById("tabs-sel-columns"));
  282.     if(mt2.height() > altura)
  283.     {
  284.       altura = mt2.height();
  285.     }
  286.     if(mt2.width() > largura)
  287.     {
  288.       largura = mt2.width();
  289.     }
  290.   }

  291.   //protect against max windows
  292.   if((altura + 220) > parent.window.innerHeight) altura = parent.window.innerHeight - 220;

  293.   if (0 == largura || 0 == altura)
  294.   {
  295.     setTimeout("ajusta_window()", 50);
  296.     return;
  297.   }
  298.   else if(!bFixed)
  299.   {
  300.     bFixed = true;
  301.     if (navigator.userAgent.indexOf("Chrome/") > 0)
  302.     {
  303.       self.parent.tb_resize(altura + 150, largura + 40);
  304.       setTimeout("ajusta_window()", 50);
  305.       return;
  306.     }
  307.   }
  308.   mt.width( largura );
  309.   self.parent.tb_resize(altura + 150, largura + 40);
  310. }

  311. $('#tabs > ul > li').click(function() {
  312.   if($(this).find("a").length)
  313.   {
  314.     $('#tabs > ul > li').removeClass("scTabActive");
  315.     $('#tabs > ul > li').addClass("scTabInactive");

  316.     $(this).removeClass("scTabInactive");
  317.     $(this).addClass("scTabActive");

  318.     $('#tabs > div').hide();
  319.     $($(this).find("a").attr("href")).show();
  320.   }
  321. });
  322. $( document ).ready(function() {
  323.    setTimeout("ajusta_window();$('#tabs > ul > li:first-child').click();", 50);
  324. <?php
  325.   if ($password == "s")
  326.   {
  327. ?>
  328.    document.config_xml.password.value = "";
  329. <?php
  330.   }
  331. ?>
  332. });

  333.   function scSubmitSelCamposAjaxExportDone()
  334.   {
  335.     saveSelColumns = true;
  336.     processa();
  337.   }

  338.   var saveSelColumns = false;
  339.   function processa()
  340.   {
  341.      <?php
  342.      if($hasSelColumns)
  343.      {
  344.       ?>
  345.       if(saveSelColumns == false)
  346.       {
  347.         scSubmitSelCamposAjaxExport();
  348.         return false;
  349.       }
  350.       <?php
  351.      }
  352.      ?>

  353.      <?php
  354.      if($export_ajax != "S" && $export_ajax != "R" && $export_ajax != "D")
  355.      {
  356.       ?>
  357.       self.parent.tb_remove();
  358.       <?php
  359.      }
  360.      ?>

  361.      xml_tag   = document.config_xml.nm_xml_tag.value;
  362.      xml_label = document.config_xml.nm_xml_label.value;

  363.      res_cons = "";
  364.      if (document.config_xml.id_tem_res_cons)
  365.      {
  366.          Nobj = document.getElementById('id_tem_res_cons').name;
  367.          obj  = document.getElementsByName(Nobj);
  368.          for (iCheck = 0; iCheck < obj.length; iCheck++) {
  369.               if (obj[iCheck].checked) {
  370.                   if (res_cons != "") {
  371.                      res_cons += ",";
  372.                   }
  373.                   res_cons += obj[iCheck].value;
  374.               }
  375.          }
  376.      }
  377.      else
  378.      {
  379.          res_cons = "<?php if ($origem == "cons") {echo "grid";} else {echo "resume";} ?>";
  380.      }
  381.      if (res_cons == "")
  382.      {
  383.         return;
  384.      }

  385.      use_pass = "";
  386.      <?php
  387.      if($password == "s")
  388.      {
  389.       ?>
  390.          use_pass = document.config_xml.password.value;
  391.       <?php
  392.      }
  393.      ?>

  394. /*--- exportacoes ajax */
  395. <?php
  396.      if ($export_ajax == 'S') {
  397. ?>
  398.          parent.nm_gp_xml_conf(xml_tag, xml_label, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', 'xml', false);return false;
  399. <?php
  400.      }
  401.      else if ($export_ajax == 'R') {
  402. ?>
  403.          parent.nm_gp_xml_conf(xml_tag, xml_label, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', 'xml_res', false);return false;
  404. <?php
  405.      } else {
  406. ?>
  407.          parent.nm_gp_xml_conf(xml_tag, xml_label, res_cons, use_pass, '<?php echo NM_encode_input($export_ajax); ?>', '', false);return false;
  408. <?php
  409.      }
  410. ?>
  411. /*--------*/

  412.     $('#bsair').click();

  413.   }
  414. </script>
  415. <script>
  416.         //colocado aqui devido a execução modal não executar o ready do jquery
  417.       setTimeout("ajusta_window()", 50);
  418. </script>
  419. </body>
  420. </html>
Return
grid_new_csv.class.php
  1. <?php

  2. class grid_new_csv
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;
  8.    var $nm_data;

  9.    var $Arquivo;
  10.    var $Tit_doc;
  11.    var $Delim_dados;
  12.    var $Delim_line;
  13.    var $Delim_col;
  14.    var $Csv_label;
  15.    var $sc_proc_grid
  16.    var $NM_cmp_hidden = array();
  17.    var $count_ger;

  18.    //---- 
  19.    function __construct()
  20.    {
  21.       $this->nm_data   = new nm_data("en_us");
  22.    }

  23.    //---- 
  24.    function monta_csv()
  25.    {
  26.       $this->inicializa_vars();
  27.       $this->grava_arquivo();
  28.       if ($this->Ini->sc_export_ajax)
  29.       {
  30.           $this->Arr_result['file_export']  = NM_charset_to_utf8($this->Csv_f);
  31.           $this->Arr_result['title_export'] = NM_charset_to_utf8($this->Tit_doc);
  32.           $Temp ob_get_clean();
  33.           if ($Temp !== false && trim($Temp) != "")
  34.           {
  35.               $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  36.           }
  37.           $oJson = new Services_JSON();
  38.           echo $oJson->encode($this->Arr_result);
  39.           exit;
  40.       }
  41.       else
  42.       {
  43.           $this->progress_bar_end();
  44.       }
  45.    }

  46.    //----- 
  47.    function inicializa_vars()
  48.    {
  49.      global $nm_lang;
  50.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  51.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  52.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  53.       require_once($this->Ini->path_aplicacao "grid_new_total.class.php"); 
  54.       $this->Tot      = new grid_new_total($this->Ini->sc_page);
  55.       $this->prep_modulos("Tot");
  56.       $Gb_geral "quebra_geral_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'];
  57.       if (method_exists($this->Tot,$Gb_geral))
  58.       {
  59.           $this->Tot->$Gb_geral();
  60.           $this->count_ger $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1];
  61.       }
  62.       $this->Csv_password "";
  63.       $this->Arquivo   "sc_csv";
  64.       $this->Arquivo  .= "_" date("YmdHis") . "_" rand(01000);
  65.       $this->Arq_zip   $this->Arquivo "_grid_new.zip";
  66.       $this->Arquivo  .= "_grid_new";
  67.       $this->Arquivo  .= ".csv";
  68.       $this->Tit_doc   "grid_new.csv";
  69.       $this->Tit_zip   "grid_new.zip";
  70.       $this->Label_CSV "N";
  71.       $this->Delim_dados "\"";
  72.       $this->Delim_col   ";";
  73.       $this->Delim_line  "\r\n";
  74.       $this->Tem_csv_res false;
  75.       if (isset($_REQUEST['nm_delim_line']) && !empty($_REQUEST['nm_delim_line']))
  76.       {
  77.           $this->Delim_line str_replace(array(1,2,3), array("\r\n","\r","\n"), $_REQUEST['nm_delim_line']);
  78.       }
  79.       if (isset($_REQUEST['nm_delim_col']) && !empty($_REQUEST['nm_delim_col']))
  80.       {
  81.           $this->Delim_col str_replace(array(1,2,3,4,5), array(";",",","\    ","#",""), $_REQUEST['nm_delim_col']);
  82.       }
  83.       if (isset($_REQUEST['nm_delim_dados']) && !empty($_REQUEST['nm_delim_dados']))
  84.       {
  85.           $this->Delim_dados str_replace(array(1,2,3,4), array('"',"'","","|"), $_REQUEST['nm_delim_dados']);
  86.       }
  87.       if (isset($_REQUEST['nm_label_csv']) && !empty($_REQUEST['nm_label_csv']))
  88.       {
  89.           $this->Label_CSV $_REQUEST['nm_label_csv'];
  90.       }
  91.           $this->Tem_csv_res  true;
  92.           if (isset($_REQUEST['SC_module_export']) && $_REQUEST['SC_module_export'] != "")
  93.           { 
  94.               $this->Tem_csv_res = (strpos(" " $_REQUEST['SC_module_export'], "resume") !== false) ? true false;
  95.           } 
  96.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total")
  97.           {
  98.               $this->Tem_csv_res  false;
  99.           }
  100.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  101.           {
  102.               $this->Tem_csv_res  false;
  103.           }
  104.       if (!$this->Ini->sc_export_ajax) {
  105.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  106.           $this->pb = new scProgressBar();
  107.           $this->pb->setRoot($this->Ini->root);
  108.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  109.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  110.           $this->pb->initialize();
  111.           $this->pb->setReturnUrl("./");
  112.           $this->pb->setReturnOption($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_return']);
  113.           if ($this->Tem_csv_res) {
  114.               $PB_plus intval ($this->count_ger 0.04);
  115.               $PB_plus = ($PB_plus 2) ? $PB_plus;
  116.           }
  117.           else {
  118.               $PB_plus intval ($this->count_ger 0.02);
  119.               $PB_plus = ($PB_plus 1) ? $PB_plus;
  120.           }
  121.           $PB_tot $this->count_ger $PB_plus;
  122.           $this->PB_dif $PB_tot $this->count_ger;
  123.           $this->pb->setTotalSteps($PB_tot );
  124.       }
  125.    }

  126.    //---- 
  127.    function prep_modulos($modulo)
  128.    {
  129.       $this->$modulo->Ini    $this->Ini;
  130.       $this->$modulo->Db     $this->Db;
  131.       $this->$modulo->Erro   $this->Erro;
  132.       $this->$modulo->Lookup $this->Lookup;
  133.    }

  134.    //----- 
  135.    function grava_arquivo()
  136.    {
  137.      global $nm_lang;
  138.       global $nm_nada$nm_lang;

  139.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  140.       $this->sc_proc_grid false
  141.       $nm_raiz_img  ""
  142.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name']))
  143.       {
  144.           $this->Arquivo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'];
  145.           $this->Arq_zip $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'];
  146.           $this->Tit_doc $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'];
  147.           $Pos strrpos($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'], ".");
  148.           if ($Pos !== false) {
  149.               $this->Arq_zip substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'], 0$Pos);
  150.           }
  151.           $this->Arq_zip .= ".zip";
  152.           $this->Tit_zip  $this->Arq_zip;
  153.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name']);
  154.       }
  155.       if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']))
  156.       {
  157.           foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display'] as $NM_cada_field => $NM_cada_opc)
  158.           {
  159.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  160.           }
  161.       }
  162.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']))
  163.       {
  164.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  165.           {
  166.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  167.           }
  168.       }
  169.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']))
  170.       {
  171.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  172.           {
  173.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  174.           }
  175.       }
  176.       $this->sc_where_orig   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  177.       $this->sc_where_atual  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  178.       $this->sc_where_filtro $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'];
  179.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']))
  180.       { 
  181.           $Busca_temp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'];
  182.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  183.           {
  184.               $Busca_temp NM_conv_charset($Busca_temp$_SESSION['scriptcase']['charset'], "UTF-8");
  185.           }
  186.           $this->proprietarios_idproprietario $Busca_temp['proprietarios_idproprietario']; 
  187.           $tmp_pos strpos($this->proprietarios_idproprietario"##@@");
  188.           if ($tmp_pos !== false && !is_array($this->proprietarios_idproprietario))
  189.           {
  190.               $this->proprietarios_idproprietario substr($this->proprietarios_idproprietario0$tmp_pos);
  191.           }
  192.           $this->proprietarios_nome $Busca_temp['proprietarios_nome']; 
  193.           $tmp_pos strpos($this->proprietarios_nome"##@@");
  194.           if ($tmp_pos !== false && !is_array($this->proprietarios_nome))
  195.           {
  196.               $this->proprietarios_nome substr($this->proprietarios_nome0$tmp_pos);
  197.           }
  198.           $this->proprietarios_sexo $Busca_temp['proprietarios_sexo']; 
  199.           $tmp_pos strpos($this->proprietarios_sexo"##@@");
  200.           if ($tmp_pos !== false && !is_array($this->proprietarios_sexo))
  201.           {
  202.               $this->proprietarios_sexo substr($this->proprietarios_sexo0$tmp_pos);
  203.           }
  204.           $this->proprietarios_cpf $Busca_temp['proprietarios_cpf']; 
  205.           $tmp_pos strpos($this->proprietarios_cpf"##@@");
  206.           if ($tmp_pos !== false && !is_array($this->proprietarios_cpf))
  207.           {
  208.               $this->proprietarios_cpf substr($this->proprietarios_cpf0$tmp_pos);
  209.           }
  210.       } 
  211.       $this->arr_export = array('label' => array(), 'lines' => array());
  212.       $this->arr_span   = array();

  213.       $this->Csv_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  214.       $this->Zip_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arq_zip;
  215.       $csv_f fopen($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo"w");
  216.       if ($this->Label_CSV == "S")
  217.       { 
  218.           $this->NM_prim_col  0;
  219.           $this->csv_registro "";
  220.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_col)
  221.           { 
  222.               $SC_Label = (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario"
  223.               if ($Cada_col == "proprietarios_idproprietario" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  224.               {
  225.                   $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  226.                   $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$SC_Label);
  227.                   $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  228.                   $this->NM_prim_col++;
  229.               }
  230.               $SC_Label = (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome"
  231.               if ($Cada_col == "proprietarios_nome" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  232.               {
  233.                   $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  234.                   $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$SC_Label);
  235.                   $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  236.                   $this->NM_prim_col++;
  237.               }
  238.               $SC_Label = (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo"
  239.               if ($Cada_col == "proprietarios_sexo" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  240.               {
  241.                   $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  242.                   $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$SC_Label);
  243.                   $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  244.                   $this->NM_prim_col++;
  245.               }
  246.               $SC_Label = (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf"
  247.               if ($Cada_col == "proprietarios_cpf" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  248.               {
  249.                   $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  250.                   $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$SC_Label);
  251.                   $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  252.                   $this->NM_prim_col++;
  253.               }
  254.               $SC_Label = (isset($this->New_label['proprietarios_telefone'])) ? $this->New_label['proprietarios_telefone'] : "Telefone"
  255.               if ($Cada_col == "proprietarios_telefone" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  256.               {
  257.                   $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  258.                   $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$SC_Label);
  259.                   $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  260.                   $this->NM_prim_col++;
  261.               }
  262.               $SC_Label = (isset($this->New_label['veiculos_idveiculos'])) ? $this->New_label['veiculos_idveiculos'] : "Id Veiculos"
  263.               if ($Cada_col == "veiculos_idveiculos" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  264.               {
  265.                   $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  266.                   $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$SC_Label);
  267.                   $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  268.                   $this->NM_prim_col++;
  269.               }
  270.               $SC_Label = (isset($this->New_label['veiculos_anomodelo'])) ? $this->New_label['veiculos_anomodelo'] : "Ano Modelo"
  271.               if ($Cada_col == "veiculos_anomodelo" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  272.               {
  273.                   $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  274.                   $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$SC_Label);
  275.                   $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  276.                   $this->NM_prim_col++;
  277.               }
  278.               $SC_Label = (isset($this->New_label['veiculos_placa'])) ? $this->New_label['veiculos_placa'] : "Placa"
  279.               if ($Cada_col == "veiculos_placa" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  280.               {
  281.                   $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  282.                   $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$SC_Label);
  283.                   $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  284.                   $this->NM_prim_col++;
  285.               }
  286.               $SC_Label = (isset($this->New_label['proprietarios_endereco'])) ? $this->New_label['proprietarios_endereco'] : "Endereco"
  287.               if ($Cada_col == "proprietarios_endereco" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  288.               {
  289.                   $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  290.                   $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$SC_Label);
  291.                   $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  292.                   $this->NM_prim_col++;
  293.               }
  294.           } 
  295.           $this->csv_registro .= $this->Delim_line;
  296.           fwrite($csv_f$this->csv_registro);
  297.       } 
  298.       $this->nm_field_dinamico = array();
  299.       $this->nm_order_dinamico = array();
  300.       $nmgp_select_count "SELECT count(*) AS countTest from " $this->Ini->nm_tabela
  301.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
  302.       { 
  303.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  304.       } 
  305.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  306.       { 
  307.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  308.       } 
  309.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  310.       { 
  311.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  312.       } 
  313.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  314.       { 
  315.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  316.       } 
  317.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
  318.       { 
  319.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  320.       } 
  321.       else 
  322.       { 
  323.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  324.       } 
  325.       $nmgp_select .= " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  326.       $nmgp_select_count .= " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  327.       $nmgp_order_by $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['order_grid'];
  328.       $nmgp_select .= $nmgp_order_by
  329.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select_count;
  330.       $rt $this->Db->Execute($nmgp_select_count);
  331.       if ($rt === false && !$rt->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1)
  332.       {
  333.          $this->Erro->mensagem(__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg());
  334.          exit;
  335.       }
  336.       $this->count_ger $rt->fields[0];
  337.       $rt->Close();
  338.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select;
  339.       $rs $this->Db->Execute($nmgp_select);
  340.       if ($rs === false && !$rs->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1)
  341.       {
  342.          $this->Erro->mensagem(__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg());
  343.          exit;
  344.       }
  345.       $this->SC_seq_register 0;
  346.       $PB_tot = (isset($this->count_ger) && $this->count_ger 0) ? "/" $this->count_ger "";
  347.       while (!$rs->EOF)
  348.       {
  349.          $this->SC_seq_register++;
  350.          if (!$this->Ini->sc_export_ajax) {
  351.              $Mens_bar $this->Ini->Nm_lang['lang_othr_prcs'];
  352.              if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  353.                  $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  354.              }
  355.              $this->pb->setProgressbarMessage($Mens_bar ": " $this->SC_seq_register $PB_tot);
  356.              $this->pb->addSteps(1);
  357.          }
  358.          $this->csv_registro "";
  359.          $this->NM_prim_col  0;
  360.          $this->proprietarios_idproprietario $rs->fields[0] ;  
  361.          $this->proprietarios_idproprietario = (string)$this->proprietarios_idproprietario;
  362.          $this->proprietarios_nome $rs->fields[1] ;  
  363.          $this->proprietarios_sexo $rs->fields[2] ;  
  364.          $this->proprietarios_cpf $rs->fields[3] ;  
  365.          $this->proprietarios_cpf = (string)$this->proprietarios_cpf;
  366.          $this->proprietarios_telefone $rs->fields[4] ;  
  367.          $this->veiculos_idveiculos $rs->fields[5] ;  
  368.          $this->veiculos_idveiculos = (string)$this->veiculos_idveiculos;
  369.          $this->veiculos_anomodelo $rs->fields[6] ;  
  370.          $this->veiculos_placa $rs->fields[7] ;  
  371.          $this->proprietarios_endereco $rs->fields[8] ;  
  372.          $this->sc_proc_grid true
  373.          foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_col)
  374.          { 
  375.             if (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off")
  376.             { 
  377.                 $NM_func_exp "NM_export_" $Cada_col;
  378.                 $this->$NM_func_exp();
  379.             } 
  380.          } 
  381.          $this->csv_registro .= $this->Delim_line;
  382.          fwrite($csv_f$this->csv_registro);
  383.          $rs->MoveNext();
  384.       }
  385.       fclose($csv_f);
  386.       if ($this->Tem_csv_res)
  387.       { 
  388.           if (!$this->Ini->sc_export_ajax) {
  389.               $this->PB_dif intval ($this->PB_dif 2);
  390.               $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  391.               $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  392.               if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  393.                   $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  394.                   $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  395.               }
  396.               $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  397.               $this->pb->addSteps($this->PB_dif);
  398.           }
  399.           require_once($this->Ini->path_aplicacao "grid_new_res_csv.class.php");
  400.           $this->Res = new grid_new_res_csv();
  401.           $this->prep_modulos("Res");
  402.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_grid'] = true;
  403.           $this->Res->monta_csv();
  404.       } 
  405.       if (!$this->Ini->sc_export_ajax) {
  406.           $Mens_bar $this->Ini->Nm_lang['lang_btns_export_finished'];
  407.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  408.               $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  409.           }
  410.           $this->pb->setProgressbarMessage($Mens_bar);
  411.           $this->pb->addSteps($this->PB_dif);
  412.       }
  413.       if ($this->Csv_password != "" || $this->Tem_csv_res)
  414.       { 
  415.           $str_zip    "";
  416.           $Parm_pass  = ($this->Csv_password != "") ? " -p" "";
  417.           $Zip_f      = (FALSE !== strpos($this->Zip_f' ')) ? " \"" $this->Zip_f "\"" :  $this->Zip_f;
  418.           $Arq_input  = (FALSE !== strpos($this->Csv_f' ')) ? " \"" $this->Csv_f "\"" :  $this->Csv_f;
  419.           if (is_file($Zip_f)) {
  420.               unlink($Zip_f);
  421.           }
  422.           if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  423.           {
  424.               chdir($this->Ini->path_third "/zip/windows");
  425.               $str_zip "zip.exe " strtoupper($Parm_pass) . " -j " $this->Csv_password " " $Zip_f " " $Arq_input;
  426.           }
  427.           elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  428.           {
  429.                 if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  430.                 {
  431.                     chdir($this->Ini->path_third "/zip/linux-i386/bin");
  432.                 }
  433.                 else
  434.                 {
  435.                     chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  436.                 }
  437.                 $str_zip "./7za " $Parm_pass $this->Csv_password " a " $Zip_f " " $Arq_input;
  438.           }
  439.           elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  440.           {
  441.               chdir($this->Ini->path_third "/zip/mac/bin");
  442.               $str_zip "./7za " $Parm_pass $this->Csv_password " a " $Zip_f " " $Arq_input;
  443.           }
  444.           if (!empty($str_zip)) {
  445.               exec($str_zip);
  446.           }
  447.           // ----- ZIP log
  448.           $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'w');
  449.           if ($fp)
  450.           {
  451.               @fwrite($fp$str_zip "\r\n\r\n");
  452.               @fclose($fp);
  453.           }
  454.           if ($this->Tem_csv_res)
  455.           { 
  456.               $str_zip    "";
  457.               $Arq_res    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_file'];
  458.               $Arq_input  = (FALSE !== strpos($Arq_res' ')) ? " \"" $Arq_res "\"" :  $Arq_res;
  459.               if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  460.               {
  461.                   $str_zip "zip.exe " strtoupper($Parm_pass) . " -j -u " $this->Csv_password " " $Zip_f " " $Arq_input;
  462.               }
  463.               elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  464.               {
  465.                   $str_zip "./7za " $Parm_pass $this->Csv_password " a " $Zip_f " " $Arq_input;
  466.               }
  467.               elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  468.               {
  469.                   $str_zip "./7za " $Parm_pass $this->Csv_password " a " $Zip_f " " $Arq_input;
  470.               }
  471.               if (!empty($str_zip)) {
  472.                   exec($str_zip);
  473.               }
  474.               // ----- ZIP log
  475.               $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'a');
  476.               if ($fp)
  477.               {
  478.                   @fwrite($fp$str_zip "\r\n\r\n");
  479.                   @fclose($fp);
  480.               }
  481.               unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_grid']);
  482.               unlink($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_file']);
  483.           }
  484.           unlink($Arq_input);
  485.           $this->Arquivo $this->Arq_zip;
  486.           $this->Csv_f   $this->Zip_f;
  487.           $this->Tit_doc $this->Tit_zip;
  488.       } 
  489.       if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']))
  490.       {
  491.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order'];
  492.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']);
  493.       }
  494.       if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']))
  495.       {
  496.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel'];
  497.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']);
  498.       }
  499.       $rs->Close();
  500.    }
  501.    //----- proprietarios_idproprietario
  502.    function NM_export_proprietarios_idproprietario()
  503.    {
  504.          nmgp_Form_Num_Val($this->proprietarios_idproprietario$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  505.       $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  506.       $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$this->proprietarios_idproprietario);
  507.       $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  508.       $this->NM_prim_col++;
  509.    }
  510.    //----- proprietarios_nome
  511.    function NM_export_proprietarios_nome()
  512.    {
  513.       $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  514.       $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$this->proprietarios_nome);
  515.       $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  516.       $this->NM_prim_col++;
  517.    }
  518.    //----- proprietarios_sexo
  519.    function NM_export_proprietarios_sexo()
  520.    {
  521.       $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  522.       $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$this->proprietarios_sexo);
  523.       $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  524.       $this->NM_prim_col++;
  525.    }
  526.    //----- proprietarios_cpf
  527.    function NM_export_proprietarios_cpf()
  528.    {
  529.          nmgp_Form_Num_Val($this->proprietarios_cpf$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  530.       $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  531.       $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$this->proprietarios_cpf);
  532.       $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  533.       $this->NM_prim_col++;
  534.    }
  535.    //----- proprietarios_telefone
  536.    function NM_export_proprietarios_telefone()
  537.    {
  538.       $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  539.       $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$this->proprietarios_telefone);
  540.       $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  541.       $this->NM_prim_col++;
  542.    }
  543.    //----- veiculos_idveiculos
  544.    function NM_export_veiculos_idveiculos()
  545.    {
  546.          nmgp_Form_Num_Val($this->veiculos_idveiculos$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  547.       $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  548.       $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$this->veiculos_idveiculos);
  549.       $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  550.       $this->NM_prim_col++;
  551.    }
  552.    //----- veiculos_anomodelo
  553.    function NM_export_veiculos_anomodelo()
  554.    {
  555.       $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  556.       $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$this->veiculos_anomodelo);
  557.       $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  558.       $this->NM_prim_col++;
  559.    }
  560.    //----- veiculos_placa
  561.    function NM_export_veiculos_placa()
  562.    {
  563.       $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  564.       $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$this->veiculos_placa);
  565.       $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  566.       $this->NM_prim_col++;
  567.    }
  568.    //----- proprietarios_endereco
  569.    function NM_export_proprietarios_endereco()
  570.    {
  571.       $col_sep = ($this->NM_prim_col 0) ? $this->Delim_col "";
  572.       $conteudo str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$this->proprietarios_endereco);
  573.       $this->csv_registro .= $col_sep $this->Delim_dados $conteudo $this->Delim_dados;
  574.       $this->NM_prim_col++;
  575.    }

  576.    function nm_conv_data_db($dt_in$form_in$form_out)
  577.    {
  578.        $dt_out $dt_in;
  579.        if (strtoupper($form_in) == "DB_FORMAT")
  580.        {
  581.            if ($dt_out == "null" || $dt_out == "")
  582.            {
  583.                $dt_out "";
  584.                return $dt_out;
  585.            }
  586.            $form_in "AAAA-MM-DD";
  587.        }
  588.        if (strtoupper($form_out) == "DB_FORMAT")
  589.        {
  590.            if (empty($dt_out))
  591.            {
  592.                $dt_out "null";
  593.                return $dt_out;
  594.            }
  595.            $form_out "AAAA-MM-DD";
  596.        }
  597.        nm_conv_form_data($dt_out$form_in$form_out);
  598.        return $dt_out;
  599.    }
  600.    function progress_bar_end()
  601.    {
  602.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file']);
  603.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  604.       {
  605.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  606.       }
  607.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  608.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  609.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  610.       $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  611.       if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  612.           $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  613.       }
  614.       $this->pb->setProgressbarMessage($Mens_bar);
  615.       $this->pb->setDownloadLink($this->Ini->path_imag_temp "/" $this->Arquivo);
  616.       $this->pb->setDownloadMd5($path_doc_md5);
  617.       $this->pb->completed();
  618.    }
  619.    //---- 
  620.    function monta_html()
  621.    {
  622.       global $nm_url_saida$nm_lang;
  623.       include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  624.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_file']);
  625.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  626.       {
  627.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  628.       }
  629.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  630.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  631.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  632. ?>
  633. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  634.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  635. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  636. <HEAD>
  637.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: CSV</TITLE>
  638.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  639.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
  640.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?>" GMT">
  641.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
  642.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0">
  643.  <META http-equiv="Pragma" content="no-cache">
  644.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  645. <?php
  646. if ($_SESSION['scriptcase']['proc_mobile'])
  647. {
  648. ?>
  649.   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  650. <?php
  651. }
  652. ?>
  653.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  654.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  655.  <?php
  656.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  657.  {
  658.  ?>
  659.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  660.  <?php
  661.  }
  662.  ?>
  663.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  664. </HEAD>
  665. <BODY class="scExportPage">
  666. <?php echo $this->Ini->Ajax_result_set ?>
  667. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  668.  <table class="scExportTable" align="center">
  669.   <tr>
  670.    <td class="scExportTitle" style="height: 25px">CSV</td>
  671.   </tr>
  672.   <tr>
  673.    <td class="scExportLine" style="width: 100%">
  674.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  675.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  676.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  677.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  678.  ?>
  679.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  680.  ?>
  681.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  682.  ?>
  683.     </td></tr></table>
  684.    </td>
  685.   </tr>
  686.  </table>
  687. </td></tr></table>
  688. <form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp "/" $this->Arquivo ?>" target="_blank" style="display: none"> 
  689. </form>
  690. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  691. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  692. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  693. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  694. </form>
  695. <FORM name="F0" method=post action="./"> 
  696. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  697. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  698. <INPUT type="hidden" name="nmgp_opcao" value="<?php echo NM_encode_input($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_return']); ?>"> 
  699. </FORM> 
  700. </BODY>
  701. </HTML>
  702. <?php
  703.    }
  704.    function nm_gera_mask(&$nm_campo$nm_mask)
  705.    { 
  706.       $trab_campo $nm_campo;
  707.       $trab_mask  $nm_mask;
  708.       $tam_campo  strlen($nm_campo);
  709.       $trab_saida "";
  710.       $mask_num false;
  711.       for ($x=0$x strlen($trab_mask); $x++)
  712.       {
  713.           if (substr($trab_mask$x1) == "#")
  714.           {
  715.               $mask_num true;
  716.               break;
  717.           }
  718.       }
  719.       if ($mask_num )
  720.       {
  721.           $ver_duas explode(";"$trab_mask);
  722.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  723.           {
  724.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  725.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  726.               if ($cont2 >= $tam_campo)
  727.               {
  728.                   $trab_mask $ver_duas[1];
  729.               }
  730.               else
  731.               {
  732.                   $trab_mask $ver_duas[0];
  733.               }
  734.           }
  735.           $tam_mask strlen($trab_mask);
  736.           $xdados 0;
  737.           for ($x=0$x $tam_mask$x++)
  738.           {
  739.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  740.               {
  741.                   $trab_saida .= substr($trab_campo$xdados1);
  742.                   $xdados++;
  743.               }
  744.               elseif ($xdados $tam_campo)
  745.               {
  746.                   $trab_saida .= substr($trab_mask$x1);
  747.               }
  748.           }
  749.           if ($xdados $tam_campo)
  750.           {
  751.               $trab_saida .= substr($trab_campo$xdados);
  752.           }
  753.           $nm_campo $trab_saida;
  754.           return;
  755.       }
  756.       for ($ix strlen($trab_mask); $ix 0$ix--)
  757.       {
  758.            $char_mask substr($trab_mask$ix 11);
  759.            if ($char_mask != "x" && $char_mask != "z")
  760.            {
  761.                $trab_saida $char_mask $trab_saida;
  762.            }
  763.            else
  764.            {
  765.                if ($tam_campo != 0)
  766.                {
  767.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  768.                    $tam_campo--;
  769.                }
  770.                else
  771.                {
  772.                    $trab_saida "0" $trab_saida;
  773.                }
  774.            }
  775.       }
  776.       if ($tam_campo != 0)
  777.       {
  778.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  779.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  780.       }
  781.    
  782.       $iz 0
  783.       for ($ix 0$ix strlen($trab_mask); $ix++)
  784.       {
  785.            $char_mask substr($trab_mask$ix1);
  786.            if ($char_mask != "x" && $char_mask != "z")
  787.            {
  788.                if ($char_mask == "." || $char_mask == ",")
  789.                {
  790.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  791.                }
  792.                else
  793.                {
  794.                    $iz++;
  795.                }
  796.            }
  797.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  798.            {
  799.                $ix strlen($trab_mask) + 1;
  800.            }
  801.            else
  802.            {
  803.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  804.            }
  805.       }
  806.       $nm_campo $trab_saida;
  807.    } 
  808. }

  809. ?>
Return
grid_new_det.class.php
  1. <?php
  2. //--- 
  3. class grid_new_det
  4. {
  5.    var $Ini;
  6.    var $Erro;
  7.    var $Db;
  8.    var $nm_data;
  9.    var $NM_raiz_img
  10.    var $nmgp_botoes
  11.    var $nm_location;
  12.    var $proprietarios_idproprietario;
  13.    var $proprietarios_nome;
  14.    var $proprietarios_sexo;
  15.    var $proprietarios_cpf;
  16.    var $proprietarios_telefone;
  17.    var $veiculos_idveiculos;
  18.    var $veiculos_anomodelo;
  19.    var $veiculos_placa;
  20.    var $proprietarios_endereco;
  21.    var $proprietarios_curso;
  22.    var $proprietarios_cod;
  23.    var $proprietarios_sat;
  24.    var $veiculos_marca;
  25.    var $veiculos_cor;
  26.    var $veiculos_idproprietario_fk;
  27.  function monta_det()
  28.  {
  29.     global 
  30.            $nm_saida$nm_lang$nmgp_cor_print$nmgp_tipo_pdf;
  31.     $this->nmgp_botoes['det_pdf'] = "on";
  32.     $this->nmgp_botoes['pdf'] = "on";
  33.     $this->nmgp_botoes['det_print'] = "on";
  34.     $this->nmgp_botoes['print'] = "on";
  35.     $this->nmgp_botoes['html'] = "on";
  36.     $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  37.     if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display']))
  38.     {
  39.         foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display'] as $NM_cada_btn => $NM_cada_opc)
  40.         {
  41.             $this->nmgp_botoes[$NM_cada_btn] = $NM_cada_opc;
  42.         }
  43.     }
  44.     if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_form']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_form'])
  45.     {
  46.     $this->nmgp_botoes['det_pdf']   = "off";
  47.     $this->nmgp_botoes['det_print'] = "off";
  48.     }
  49.     if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']))
  50.     { 
  51.         $Busca_temp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'];
  52.         if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  53.         {
  54.             $Busca_temp NM_conv_charset($Busca_temp$_SESSION['scriptcase']['charset'], "UTF-8");
  55.         }
  56.         $this->proprietarios_idproprietario $Busca_temp['proprietarios_idproprietario']; 
  57.         $tmp_pos strpos($this->proprietarios_idproprietario"##@@");
  58.         if ($tmp_pos !== false && !is_array($this->proprietarios_idproprietario))
  59.         {
  60.             $this->proprietarios_idproprietario substr($this->proprietarios_idproprietario0$tmp_pos);
  61.         }
  62.         $this->proprietarios_nome $Busca_temp['proprietarios_nome']; 
  63.         $tmp_pos strpos($this->proprietarios_nome"##@@");
  64.         if ($tmp_pos !== false && !is_array($this->proprietarios_nome))
  65.         {
  66.             $this->proprietarios_nome substr($this->proprietarios_nome0$tmp_pos);
  67.         }
  68.         $this->proprietarios_sexo $Busca_temp['proprietarios_sexo']; 
  69.         $tmp_pos strpos($this->proprietarios_sexo"##@@");
  70.         if ($tmp_pos !== false && !is_array($this->proprietarios_sexo))
  71.         {
  72.             $this->proprietarios_sexo substr($this->proprietarios_sexo0$tmp_pos);
  73.         }
  74.         $this->proprietarios_cpf $Busca_temp['proprietarios_cpf']; 
  75.         $tmp_pos strpos($this->proprietarios_cpf"##@@");
  76.         if ($tmp_pos !== false && !is_array($this->proprietarios_cpf))
  77.         {
  78.             $this->proprietarios_cpf substr($this->proprietarios_cpf0$tmp_pos);
  79.         }
  80.     } 
  81.     $this->sc_where_orig   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  82.     $this->sc_where_atual  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  83.     $this->sc_where_filtro $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'];
  84.     $this->nm_field_dinamico = array();
  85.     $this->nm_order_dinamico = array();
  86.     $this->nm_data = new nm_data("en_us");
  87.     $this->NM_raiz_img  ""
  88.     if ($this->Ini->sc_export_ajax_img)
  89.     { 
  90.         $this->NM_raiz_img $this->Ini->root
  91.     } 
  92.     $this->sc_proc_grid false
  93.     include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  94.     $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['seq_dir'] = 0
  95.     $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sub_dir'] = array(); 
  96.    $Str_date strtolower($_SESSION['scriptcase']['reg_conf']['date_format']);
  97.    $Lim   strlen($Str_date);
  98.    $Ult   "";
  99.    $Arr_D = array();
  100.    for ($I 0$I $Lim$I++)
  101.    {
  102.        $Char substr($Str_date$I1);
  103.        if ($Char != $Ult)
  104.        {
  105.            $Arr_D[] = $Char;
  106.        }
  107.        $Ult $Char;
  108.    }
  109.    $Prim true;
  110.    $Str  "";
  111.    foreach ($Arr_D as $Cada_d)
  112.    {
  113.        $Str .= (!$Prim) ? $_SESSION['scriptcase']['reg_conf']['date_sep'] : "";
  114.        $Str .= $Cada_d;
  115.        $Prim false;
  116.    }
  117.    $Str str_replace("a""Y"$Str);
  118.    $Str str_replace("y""Y"$Str);
  119.    $nm_data_fixa date($Str); 
  120.    $this->nm_data->SetaData(date("Y/m/d H:i:s"), "YYYY/MM/DD HH:II:SS"); 
  121.    $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_edit.php""F""nmgp_Form_Num_Val") ; 
  122.    if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase)) 
  123.    { 
  124.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Endereco as proprietarios_endereco, Proprietarios.Telefone as proprietarios_telefone, Proprietarios.Curso as proprietarios_curso, Proprietarios.Cod as proprietarios_cod, Proprietarios.SAT as proprietarios_sat, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Marca as veiculos_marca, Veiculos.Cor as veiculos_cor, Veiculos.Placa as veiculos_placa, Veiculos.idProprietario_fk as veiculos_idproprietario_fk from " $this->Ini->nm_tabela
  125.    } 
  126.    elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql)) 
  127.    { 
  128.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Endereco as proprietarios_endereco, Proprietarios.Telefone as proprietarios_telefone, Proprietarios.Curso as proprietarios_curso, Proprietarios.Cod as proprietarios_cod, Proprietarios.SAT as proprietarios_sat, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Marca as veiculos_marca, Veiculos.Cor as veiculos_cor, Veiculos.Placa as veiculos_placa, Veiculos.idProprietario_fk as veiculos_idproprietario_fk from " $this->Ini->nm_tabela
  129.    } 
  130.    elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle)) 
  131.    { 
  132.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Endereco as proprietarios_endereco, Proprietarios.Telefone as proprietarios_telefone, Proprietarios.Curso as proprietarios_curso, Proprietarios.Cod as proprietarios_cod, Proprietarios.SAT as proprietarios_sat, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Marca as veiculos_marca, Veiculos.Cor as veiculos_cor, Veiculos.Placa as veiculos_placa, Veiculos.idProprietario_fk as veiculos_idproprietario_fk from " $this->Ini->nm_tabela
  133.    } 
  134.    elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix)) 
  135.    { 
  136.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Endereco as proprietarios_endereco, Proprietarios.Telefone as proprietarios_telefone, Proprietarios.Curso as proprietarios_curso, Proprietarios.Cod as proprietarios_cod, Proprietarios.SAT as proprietarios_sat, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Marca as veiculos_marca, Veiculos.Cor as veiculos_cor, Veiculos.Placa as veiculos_placa, Veiculos.idProprietario_fk as veiculos_idproprietario_fk from " $this->Ini->nm_tabela
  137.    } 
  138.    else 
  139.    { 
  140.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Endereco as proprietarios_endereco, Proprietarios.Telefone as proprietarios_telefone, Proprietarios.Curso as proprietarios_curso, Proprietarios.Cod as proprietarios_cod, Proprietarios.SAT as proprietarios_sat, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Marca as veiculos_marca, Veiculos.Cor as veiculos_cor, Veiculos.Placa as veiculos_placa, Veiculos.idProprietario_fk as veiculos_idproprietario_fk from " $this->Ini->nm_tabela
  141.    } 
  142.    $parms_det explode("*PDet*"$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['chave_det']) ; 
  143.    foreach ($parms_det as $key => $cada_par)
  144.    {
  145.        $parms_det[$key] = $this->Db->qstr($parms_det[$key]);
  146.        $parms_det[$key] = substr($parms_det[$key], 1strlen($parms_det[$key]) - 2);
  147.    } 
  148.    if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  149.    {
  150.        $nmgp_select .= " where  Proprietarios.idProprietario = $parms_det[0] and Proprietarios.Nome = '$parms_det[1]' and Proprietarios.Sexo = '$parms_det[2]' and Proprietarios.Cpf = $parms_det[3] and Proprietarios.Telefone = '$parms_det[4]' and Veiculos.idVeiculos = $parms_det[5] and Veiculos.AnoModelo = '$parms_det[6]' and Veiculos.Placa = '$parms_det[7]' and Proprietarios.Endereco = '$parms_det[8]'" ;  
  151.    } 
  152.    elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  153.    {
  154.        $nmgp_select .= " where  Proprietarios.idProprietario = $parms_det[0] and Proprietarios.Nome = '$parms_det[1]' and Proprietarios.Sexo = '$parms_det[2]' and Proprietarios.Cpf = $parms_det[3] and Proprietarios.Telefone = '$parms_det[4]' and Veiculos.idVeiculos = $parms_det[5] and Veiculos.AnoModelo = '$parms_det[6]' and Veiculos.Placa = '$parms_det[7]' and Proprietarios.Endereco = '$parms_det[8]'" ;  
  155.    } 
  156.    else 
  157.    { 
  158.        $nmgp_select .= " where  Proprietarios.idProprietario = $parms_det[0] and Proprietarios.Nome = '$parms_det[1]' and Proprietarios.Sexo = '$parms_det[2]' and Proprietarios.Cpf = $parms_det[3] and Proprietarios.Telefone = '$parms_det[4]' and Veiculos.idVeiculos = $parms_det[5] and Veiculos.AnoModelo = '$parms_det[6]' and Veiculos.Placa = '$parms_det[7]' and Proprietarios.Endereco = '$parms_det[8]'" ;  
  159.    } 
  160.    $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  161.    $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select
  162.    $rs $this->Db->Execute($nmgp_select) ; 
  163.    if ($rs === false && !$rs->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1
  164.    { 
  165.        $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  166.        exit ; 
  167.    }  
  168.    $this->proprietarios_idproprietario $rs->fields[0] ;  
  169.    $this->proprietarios_idproprietario = (string)$this->proprietarios_idproprietario;
  170.    $this->proprietarios_nome $rs->fields[1] ;  
  171.    $this->proprietarios_sexo $rs->fields[2] ;  
  172.    $this->proprietarios_cpf $rs->fields[3] ;  
  173.    $this->proprietarios_cpf = (string)$this->proprietarios_cpf;
  174.    $this->proprietarios_endereco $rs->fields[4] ;  
  175.    $this->proprietarios_telefone $rs->fields[5] ;  
  176.    $this->proprietarios_curso $rs->fields[6] ;  
  177.    $this->proprietarios_cod $rs->fields[7] ;  
  178.    $this->proprietarios_sat $rs->fields[8] ;  
  179.    $this->veiculos_idveiculos $rs->fields[9] ;  
  180.    $this->veiculos_idveiculos = (string)$this->veiculos_idveiculos;
  181.    $this->veiculos_anomodelo $rs->fields[10] ;  
  182.    $this->veiculos_marca $rs->fields[11] ;  
  183.    $this->veiculos_cor $rs->fields[12] ;  
  184.    $this->veiculos_placa $rs->fields[13] ;  
  185.    $this->veiculos_idproprietario_fk $rs->fields[14] ;  
  186.    $this->veiculos_idproprietario_fk = (string)$this->veiculos_idproprietario_fk;
  187.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cmp_acum']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cmp_acum']))
  188.    {
  189.        $parms_acum explode(";"$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cmp_acum']);
  190.        foreach ($parms_acum as $cada_par)
  191.        {
  192.           $cada_val explode("="$cada_par);
  193.           $this->$cada_val[0] = $cada_val[1];
  194.        }
  195.    }
  196. //--- 
  197.    $nm_saida->saida("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n");
  198.    $nm_saida->saida("            \"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd\">\r\n");
  199.    $nm_saida->saida("<html" $_SESSION['scriptcase']['reg_conf']['html_dir'] . ">\r\n");
  200.    $nm_saida->saida("<HEAD>\r\n");
  201.    $nm_saida->saida("   <TITLE>" $this->Ini->Nm_lang['lang_othr_detl_title'] . " </TITLE>\r\n");
  202.    $nm_saida->saida(" <META http-equiv=\"Content-Type\" content=\"text/html; charset=" $_SESSION['scriptcase']['charset_html'] . "\" />\r\n");
  203.    $nm_saida->saida(" <META http-equiv=\"Expires\" content=\"Fri, Jan 01 1900 00:00:00 GMT\"/>\r\n");
  204.    $nm_saida->saida(" <META http-equiv=\"Last-Modified\" content=\"" gmdate("D, d M Y H:i:s") . " GMT\"/>\r\n");
  205.    $nm_saida->saida(" <META http-equiv=\"Cache-Control\" content=\"no-store, no-cache, must-revalidate\"/>\r\n");
  206.    $nm_saida->saida(" <META http-equiv=\"Cache-Control\" content=\"post-check=0, pre-check=0\"/>\r\n");
  207.    $nm_saida->saida(" <META http-equiv=\"Pragma\" content=\"no-cache\"/>\r\n");
  208.    $nm_saida->saida(" <link rel=\"shortcut icon\" href=\"../_lib/img/scriptcase__NM__ico__NM__favicon.ico\">\r\n");
  209.    if ($_SESSION['scriptcase']['proc_mobile'])
  210.    {
  211.        $nm_saida->saida(" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" />\r\n");
  212.    }

  213.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"grid_new_jquery.js\"></script>\r\n");
  214.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"grid_new_ajax.js\"></script>\r\n");
  215.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"grid_new_message.js\"></script>\r\n");
  216.            $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  217.            $nm_saida->saida("     var applicationKeys = '';\r\n");
  218.            $nm_saida->saida("     applicationKeys += 'alt+q';\r\n");
  219.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  220.            $nm_saida->saida("     applicationKeys += 'alt+p';\r\n");
  221.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  222.            $nm_saida->saida("     applicationKeys += 'ctrl+p';\r\n");
  223.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  224.            $nm_saida->saida("     applicationKeys += 'f1';\r\n");
  225.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  226.            $nm_saida->saida("     applicationKeys += 'alt+shift+p';\r\n");
  227.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  228.            $nm_saida->saida("     applicationKeys += 'alt+shift+h';\r\n");
  229.            $nm_saida->saida("     var hotkeyList = '';\r\n");
  230.            $nm_saida->saida("     function execHotKey(e, h) {\r\n");
  231.            $nm_saida->saida("         var hotkey_fired = false\r\n");
  232.            $nm_saida->saida("         switch (true) {\r\n");
  233.            $nm_saida->saida("             case (['alt+q'].indexOf(h.key) > -1):\r\n");
  234.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_sai');\r\n");
  235.            $nm_saida->saida("                 break;\r\n");
  236.            $nm_saida->saida("             case (['alt+p'].indexOf(h.key) > -1):\r\n");
  237.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_pdf');\r\n");
  238.            $nm_saida->saida("                 break;\r\n");
  239.            $nm_saida->saida("             case (['ctrl+p'].indexOf(h.key) > -1):\r\n");
  240.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_imp');\r\n");
  241.            $nm_saida->saida("                 break;\r\n");
  242.            $nm_saida->saida("             case (['f1'].indexOf(h.key) > -1):\r\n");
  243.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_webh');\r\n");
  244.            $nm_saida->saida("                 break;\r\n");
  245.            $nm_saida->saida("             case (['alt+shift+p'].indexOf(h.key) > -1):\r\n");
  246.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_pdf');\r\n");
  247.            $nm_saida->saida("                 break;\r\n");
  248.            $nm_saida->saida("             case (['alt+shift+h'].indexOf(h.key) > -1):\r\n");
  249.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_html');\r\n");
  250.            $nm_saida->saida("                 break;\r\n");
  251.            $nm_saida->saida("         }\r\n");
  252.            $nm_saida->saida("         if (hotkey_fired) {\r\n");
  253.            $nm_saida->saida("             e.preventDefault();\r\n");
  254.            $nm_saida->saida("             return false;\r\n");
  255.            $nm_saida->saida("         } else {\r\n");
  256.            $nm_saida->saida("             return true;\r\n");
  257.            $nm_saida->saida("         }\r\n");
  258.            $nm_saida->saida("     }\r\n");
  259.            $nm_saida->saida("   </script>\r\n");
  260.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/hotkeys.inc.js\"></script>\r\n");
  261.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/hotkeys_setup.js\"></script>\r\n");
  262.    $nm_saida->saida(" <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/jquery/js/jquery.js\"></script>\r\n");
  263.    $nm_saida->saida(" <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/jquery_plugin/malsup-blockui/jquery.blockUI.js\"></script>\r\n");
  264.            $nm_saida->saida(" <script type=\"text/javascript\">\r\n");
  265.            $nm_saida->saida("  var sc_pathToTB = '" $this->Ini->path_prod "/third/jquery_plugin/thickbox/';\r\n");
  266.            $nm_saida->saida("  var sc_tbLangClose = \"" html_entity_decode($this->Ini->Nm_lang['lang_tb_close'], ENT_COMPAT$_SESSION['scriptcase']['charset']) . "\";\r\n");
  267.            $nm_saida->saida("  var sc_tbLangEsc = \"" html_entity_decode($this->Ini->Nm_lang['lang_tb_esc'], ENT_COMPAT$_SESSION['scriptcase']['charset']) . "\";\r\n");
  268.            $nm_saida->saida(" </script>\r\n");
  269.    $nm_saida->saida(" <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/jquery_plugin/thickbox/thickbox-compressed.js\"></script>\r\n");
  270.            $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  271.            $nm_saida->saida("     var sc_ajaxBg = '" $this->Ini->Color_bg_ajax "';\r\n");
  272.            $nm_saida->saida("     var sc_ajaxBordC = '" $this->Ini->Border_c_ajax "';\r\n");
  273.            $nm_saida->saida("     var sc_ajaxBordS = '" $this->Ini->Border_s_ajax "';\r\n");
  274.            $nm_saida->saida("     var sc_ajaxBordW = '" $this->Ini->Border_w_ajax "';\r\n");
  275.            $nm_saida->saida("   </script>\r\n");
  276.    $nm_saida->saida(" <link rel=\"stylesheet\" href=\"" $this->Ini->path_prod "/third/jquery_plugin/thickbox/thickbox.css\" type=\"text/css\" media=\"screen\" />\r\n");
  277.    if (($this->Ini->sc_export_ajax || $this->Ini->Export_det_zip) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['det_print'] == "print")
  278.    {
  279.        if (strtoupper($nmgp_cor_print) == "PB")
  280.        {
  281.            $NM_css_file $this->Ini->str_schema_all "_grid_bw.css";
  282.            $NM_css_dir  $this->Ini->str_schema_all "_grid_bw" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
  283.        }
  284.        else
  285.        {
  286.            $NM_css_file $this->Ini->str_schema_all "_grid.css";
  287.            $NM_css_dir  $this->Ini->str_schema_all "_grid" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
  288.        }
  289.        $NM_css_cmp  $this->Ini->path_link "grid_new/grid_new_det_" strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) . ".css";
  290.        $nm_saida->saida("  <style type=\"text/css\">\r\n");
  291.        if (is_file($this->Ini->path_css $NM_css_file))
  292.        {
  293.            $NM_css_attr file($this->Ini->path_css $NM_css_file);
  294.            foreach ($NM_css_attr as $NM_line_css)
  295.            {
  296.                $nm_saida->saida(" " $NM_line_css " \r\n");
  297.            }
  298.        }
  299.        if (is_file($this->Ini->path_css $NM_css_dir))
  300.        {
  301.            $NM_css_attr file($this->Ini->path_css $NM_css_dir);
  302.            foreach ($NM_css_attr as $NM_line_css)
  303.            {
  304.                $nm_saida->saida(" " $NM_line_css " \r\n");
  305.            }
  306.        }
  307.        if (is_file($this->Ini->root $NM_css_cmp))
  308.        {
  309.            $NM_css_attr file($this->Ini->root $NM_css_cmp);
  310.            foreach ($NM_css_attr as $NM_line_css)
  311.            {
  312.                $nm_saida->saida(" " $NM_line_css " \r\n");
  313.            }
  314.        }
  315.        $nm_saida->saida("  </style>\r\n");
  316.    }
  317.    elseif (($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['det_print'] == "print" && strtoupper($nmgp_cor_print) == "PB") || $nmgp_tipo_pdf == "pb")
  318.    {
  319.        $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"" $this->Ini->path_link "_lib/css/" $this->Ini->str_schema_all "_grid_bw.css\" /> \r\n");
  320.        $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"" $this->Ini->path_link "_lib/css/" $this->Ini->str_schema_all "_grid_bw" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" /> \r\n");
  321.        $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"" $this->Ini->path_link "grid_new/grid_new_det_" strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) . ".css\" />\r\n");
  322.    }
  323.    else
  324.    {
  325.        $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"" $this->Ini->path_link "_lib/css/" $this->Ini->str_schema_all "_grid.css\" /> \r\n");
  326.        $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"" $this->Ini->path_link "_lib/css/" $this->Ini->str_schema_all "_grid" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" /> \r\n");
  327.        $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"" $this->Ini->path_link "grid_new/grid_new_det_" strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) . ".css\" />\r\n");
  328.    }
  329.        $nm_saida->saida(" <link rel=\"stylesheet\" href=\"" $this->Ini->path_prod "/third/font-awesome/css/all.min.css\" type=\"text/css\" media=\"screen\" />\r\n");
  330.    if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts)) 
  331.    { 
  332.        $nm_saida->saida(" <link href=\"" $this->Ini->str_google_fonts "\" rel=\"stylesheet\" /> \r\n");
  333.    } 
  334.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_det'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['det_print'] != "print")
  335.    {
  336.        $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/buttons/" $this->Ini->Str_btn_css "\" /> \r\n");
  337.        $nm_saida->saida(" <link rel=\"stylesheet\" href=\"../_lib/css/" $_SESSION['scriptcase']['erro']['str_schema'] . "\" type=\"text/css\" media=\"screen\" />\r\n");
  338.        $nm_saida->saida(" <link rel=\"stylesheet\" href=\"../_lib/css/" $_SESSION['scriptcase']['erro']['str_schema_dir'] . "\" type=\"text/css\" media=\"screen\" />\r\n");
  339.    }
  340.    $nm_saida->saida("</HEAD>\r\n");
  341.    if (!$this->Ini->Export_html_zip && !$this->Ini->Export_det_zip && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['det_print'] == "print")
  342.    {
  343.        $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/buttons/" $this->Ini->Str_btn_css "\" /> \r\n");
  344.        $nm_saida->saida("  <body class=\"scGridPage\"  style=\"-webkit-print-color-adjust: exact;\">\r\n");
  345.        $nm_saida->saida("   <TABLE id=\"sc_table_print\" cellspacing=0 cellpadding=0 align=\"center\" valign=\"top\" >\r\n");
  346.        $nm_saida->saida("     <TR>\r\n");
  347.        $nm_saida->saida("       <TD>\r\n");
  348.        $Cod_Btn nmButtonOutput($this->arr_buttons"bprint""prit_web_page()""prit_web_page()""Bprint_print""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  349.        $nm_saida->saida("           $Cod_Btn \r\n");
  350.        $nm_saida->saida("       </TD>\r\n");
  351.        $nm_saida->saida("     </TR>\r\n");
  352.        $nm_saida->saida("   </TABLE>\r\n");
  353.        $nm_saida->saida("  <script type=\"text/javascript\">\r\n");
  354.        $nm_saida->saida("     function prit_web_page()\r\n");
  355.        $nm_saida->saida("     {\r\n");
  356.        $nm_saida->saida("        document.getElementById('sc_table_print').style.display = 'none';\r\n");
  357.        $nm_saida->saida("        var is_safari = navigator.userAgent.indexOf(\"Safari\") > -1;\r\n");
  358.        $nm_saida->saida("        var is_chrome = navigator.userAgent.indexOf('Chrome') > -1\r\n");
  359.        $nm_saida->saida("        if ((is_chrome) && (is_safari)) {is_safari=false;}\r\n");
  360.        $nm_saida->saida("        window.print();\r\n");
  361.        $nm_saida->saida("        if (is_safari) {setTimeout(\"window.close()\", 1000);} else {window.close();}\r\n");
  362.        $nm_saida->saida("     }\r\n");
  363.        $nm_saida->saida("  </script>\r\n");
  364.    }
  365.    else
  366.    {
  367.        $nm_saida->saida("  <body class=\"scGridPage\">\r\n");
  368.    }
  369.    $nm_saida->saida("  " $this->Ini->Ajax_result_set "\r\n");
  370.            $nm_saida->saida("  <div id=\"id_div_process\" style=\"display: none; margin: 10px; whitespace: nowrap\" class=\"scFormProcessFixed\"><span class=\"scFormProcess\"><img border=\"0\" src=\"" $this->Ini->path_icones "/scriptcase__NM__ajax_load.gif\" align=\"absmiddle\" />&nbsp;" $this->Ini->Nm_lang['lang_othr_prcs'] . "...</span></div>\r\n");
  371.            $nm_saida->saida("  <div id=\"id_div_process_block\" style=\"display: none; margin: 10px; whitespace: nowrap\"><span class=\"scFormProcess\"><img border=\"0\" src=\"" $this->Ini->path_icones "/scriptcase__NM__ajax_load.gif\" align=\"absmiddle\" />&nbsp;" $this->Ini->Nm_lang['lang_othr_prcs'] . "...</span></div>\r\n");
  372.    $nm_saida->saida("<table border=0 align=\"center\" valign=\"top\" ><tr><td style=\"padding: 0px\"><div class=\"scGridBorder\"><table width='100%' cellspacing=0 cellpadding=0><tr><td>\r\n");
  373.    $nm_saida->saida("<tr><td class=\"scGridTabelaTd\">\r\n");
  374.    $nm_saida->saida("<style>\r\n");
  375.    $nm_saida->saida("    .scMenuTHeaderFont img, .scGridHeaderFont img , .scFormHeaderFont img , .scTabHeaderFont img , .scContainerHeaderFont img , .scFilterHeaderFont img { height:23px;}\r\n");
  376.    $nm_saida->saida("</style>\r\n");
  377.    $nm_saida->saida("<div class=\"scGridHeader\" style=\"height: 54px; padding: 17px 15px; box-sizing: border-box;margin: -1px 0px 0px 0px;width: 100%;\">\r\n");
  378.    $nm_saida->saida("    <div class=\"scGridHeaderFont\" style=\"float: left; text-transform: uppercase;\"></div>\r\n");
  379.    $nm_saida->saida("    <div class=\"scGridHeaderFont\" style=\"float: right;\"></div>\r\n");
  380.    $nm_saida->saida("</div>\r\n");
  381.    $nm_saida->saida("  </TD>\r\n");
  382.    $nm_saida->saida(" </TR>\r\n");
  383.    if(isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])
  384.    {
  385.        $this->nmgp_barra_det_top_mobile();
  386.    }
  387.    else
  388.    {
  389.        $this->nmgp_barra_det_top_normal();
  390.    }
  391.    $nm_saida->saida("<tr><td class=\"scGridTabelaTd\" id='idDetailTable'>\r\n");
  392.    $nm_saida->saida("<TABLE style=\"padding: 0px; spacing: 0px; border-width: 0px;\" class=\"scGridTabela\" align=\"center\" valign=\"top\" width=\"100%\">\r\n");
  393.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  394.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  395.    {
  396.        $this->SC_nowrap "NOWRAP";
  397.    }
  398.    else
  399.    {
  400.        $this->SC_nowrap "NOWRAP";
  401.    }
  402.    $SC_Label = (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario"
  403.    $conteudo trim(NM_encode_input(sc_strip_script($this->proprietarios_idproprietario))); 
  404.           if ($conteudo === ""
  405.           { 
  406.               $conteudo "&nbsp;" 
  407.           } 
  408.           else    
  409.           { 
  410.               nmgp_Form_Num_Val($conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  411.           } 
  412.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_proprietarios_idproprietario_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  413.    $nm_saida->saida("    <TD class=\"scGridFieldOddVert css_proprietarios_idproprietario_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  414.    $nm_saida->saida("   \r\n");
  415.    $nm_saida->saida("  </TR>\r\n");
  416.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  417.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  418.    {
  419.        $this->SC_nowrap "";
  420.    }
  421.    else
  422.    {
  423.        $this->SC_nowrap "";
  424.    }
  425.    $SC_Label = (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome"
  426.    $conteudo trim(sc_strip_script($this->proprietarios_nome)); 
  427.           if ($conteudo === ""
  428.           { 
  429.               $conteudo "&nbsp;" 
  430.           } 
  431.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_proprietarios_nome_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  432.    $nm_saida->saida("    <TD class=\"scGridFieldEvenVert css_proprietarios_nome_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  433.    $nm_saida->saida("   \r\n");
  434.    $nm_saida->saida("  </TR>\r\n");
  435.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  436.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  437.    {
  438.        $this->SC_nowrap "";
  439.    }
  440.    else
  441.    {
  442.        $this->SC_nowrap "";
  443.    }
  444.    $SC_Label = (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo"
  445.    $conteudo trim(sc_strip_script($this->proprietarios_sexo)); 
  446.           if ($conteudo === ""
  447.           { 
  448.               $conteudo "&nbsp;" 
  449.           } 
  450.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_proprietarios_sexo_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  451.    $nm_saida->saida("    <TD class=\"scGridFieldOddVert css_proprietarios_sexo_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  452.    $nm_saida->saida("   \r\n");
  453.    $nm_saida->saida("  </TR>\r\n");
  454.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  455.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  456.    {
  457.        $this->SC_nowrap "NOWRAP";
  458.    }
  459.    else
  460.    {
  461.        $this->SC_nowrap "NOWRAP";
  462.    }
  463.    $SC_Label = (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf"
  464.    $conteudo trim(NM_encode_input(sc_strip_script($this->proprietarios_cpf))); 
  465.           if ($conteudo === ""
  466.           { 
  467.               $conteudo "&nbsp;" 
  468.           } 
  469.           else    
  470.           { 
  471.               nmgp_Form_Num_Val($conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  472.           } 
  473.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_proprietarios_cpf_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  474.    $nm_saida->saida("    <TD class=\"scGridFieldEvenVert css_proprietarios_cpf_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  475.    $nm_saida->saida("   \r\n");
  476.    $nm_saida->saida("  </TR>\r\n");
  477.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  478.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  479.    {
  480.        $this->SC_nowrap "";
  481.    }
  482.    else
  483.    {
  484.        $this->SC_nowrap "";
  485.    }
  486.    $SC_Label = (isset($this->New_label['proprietarios_endereco'])) ? $this->New_label['proprietarios_endereco'] : "Endereco"
  487.    $conteudo trim(sc_strip_script($this->proprietarios_endereco)); 
  488.           if ($conteudo === ""
  489.           { 
  490.               $conteudo "&nbsp;" 
  491.           } 
  492.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_proprietarios_endereco_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  493.    $nm_saida->saida("    <TD class=\"scGridFieldOddVert css_proprietarios_endereco_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  494.    $nm_saida->saida("   \r\n");
  495.    $nm_saida->saida("  </TR>\r\n");
  496.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  497.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  498.    {
  499.        $this->SC_nowrap "";
  500.    }
  501.    else
  502.    {
  503.        $this->SC_nowrap "";
  504.    }
  505.    $SC_Label = (isset($this->New_label['proprietarios_telefone'])) ? $this->New_label['proprietarios_telefone'] : "Telefone"
  506.    $conteudo trim(sc_strip_script($this->proprietarios_telefone)); 
  507.           if ($conteudo === ""
  508.           { 
  509.               $conteudo "&nbsp;" 
  510.           } 
  511.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_proprietarios_telefone_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  512.    $nm_saida->saida("    <TD class=\"scGridFieldEvenVert css_proprietarios_telefone_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  513.    $nm_saida->saida("   \r\n");
  514.    $nm_saida->saida("  </TR>\r\n");
  515.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  516.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  517.    {
  518.        $this->SC_nowrap "";
  519.    }
  520.    else
  521.    {
  522.        $this->SC_nowrap "";
  523.    }
  524.    $SC_Label = (isset($this->New_label['proprietarios_curso'])) ? $this->New_label['proprietarios_curso'] : "Curso"
  525.    $conteudo trim(sc_strip_script($this->proprietarios_curso)); 
  526.           if ($conteudo === ""
  527.           { 
  528.               $conteudo "&nbsp;" 
  529.           } 
  530.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_proprietarios_curso_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  531.    $nm_saida->saida("    <TD class=\"scGridFieldOddVert css_proprietarios_curso_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  532.    $nm_saida->saida("   \r\n");
  533.    $nm_saida->saida("  </TR>\r\n");
  534.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  535.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  536.    {
  537.        $this->SC_nowrap "";
  538.    }
  539.    else
  540.    {
  541.        $this->SC_nowrap "";
  542.    }
  543.    $SC_Label = (isset($this->New_label['proprietarios_cod'])) ? $this->New_label['proprietarios_cod'] : "Cod"
  544.    $conteudo trim(sc_strip_script($this->proprietarios_cod)); 
  545.           if ($conteudo === ""
  546.           { 
  547.               $conteudo "&nbsp;" 
  548.           } 
  549.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_proprietarios_cod_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  550.    $nm_saida->saida("    <TD class=\"scGridFieldEvenVert css_proprietarios_cod_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  551.    $nm_saida->saida("   \r\n");
  552.    $nm_saida->saida("  </TR>\r\n");
  553.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  554.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  555.    {
  556.        $this->SC_nowrap "";
  557.    }
  558.    else
  559.    {
  560.        $this->SC_nowrap "";
  561.    }
  562.    $SC_Label = (isset($this->New_label['proprietarios_sat'])) ? $this->New_label['proprietarios_sat'] : "SAT"
  563.    $conteudo trim(sc_strip_script($this->proprietarios_sat)); 
  564.           if ($conteudo === ""
  565.           { 
  566.               $conteudo "&nbsp;" 
  567.           } 
  568.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_proprietarios_sat_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  569.    $nm_saida->saida("    <TD class=\"scGridFieldOddVert css_proprietarios_sat_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  570.    $nm_saida->saida("   \r\n");
  571.    $nm_saida->saida("  </TR>\r\n");
  572.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  573.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  574.    {
  575.        $this->SC_nowrap "NOWRAP";
  576.    }
  577.    else
  578.    {
  579.        $this->SC_nowrap "NOWRAP";
  580.    }
  581.    $SC_Label = (isset($this->New_label['veiculos_idveiculos'])) ? $this->New_label['veiculos_idveiculos'] : "Id Veiculos"
  582.    $conteudo trim(NM_encode_input(sc_strip_script($this->veiculos_idveiculos))); 
  583.           if ($conteudo === ""
  584.           { 
  585.               $conteudo "&nbsp;" 
  586.           } 
  587.           else    
  588.           { 
  589.               nmgp_Form_Num_Val($conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  590.           } 
  591.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_veiculos_idveiculos_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  592.    $nm_saida->saida("    <TD class=\"scGridFieldEvenVert css_veiculos_idveiculos_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  593.    $nm_saida->saida("   \r\n");
  594.    $nm_saida->saida("  </TR>\r\n");
  595.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  596.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  597.    {
  598.        $this->SC_nowrap "";
  599.    }
  600.    else
  601.    {
  602.        $this->SC_nowrap "";
  603.    }
  604.    $SC_Label = (isset($this->New_label['veiculos_anomodelo'])) ? $this->New_label['veiculos_anomodelo'] : "Ano Modelo"
  605.    $conteudo trim(sc_strip_script($this->veiculos_anomodelo)); 
  606.           if ($conteudo === ""
  607.           { 
  608.               $conteudo "&nbsp;" 
  609.           } 
  610.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_veiculos_anomodelo_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  611.    $nm_saida->saida("    <TD class=\"scGridFieldOddVert css_veiculos_anomodelo_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  612.    $nm_saida->saida("   \r\n");
  613.    $nm_saida->saida("  </TR>\r\n");
  614.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  615.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  616.    {
  617.        $this->SC_nowrap "";
  618.    }
  619.    else
  620.    {
  621.        $this->SC_nowrap "";
  622.    }
  623.    $SC_Label = (isset($this->New_label['veiculos_marca'])) ? $this->New_label['veiculos_marca'] : "Marca"
  624.    $conteudo trim(sc_strip_script($this->veiculos_marca)); 
  625.           if ($conteudo === ""
  626.           { 
  627.               $conteudo "&nbsp;" 
  628.           } 
  629.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_veiculos_marca_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  630.    $nm_saida->saida("    <TD class=\"scGridFieldEvenVert css_veiculos_marca_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  631.    $nm_saida->saida("   \r\n");
  632.    $nm_saida->saida("  </TR>\r\n");
  633.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  634.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  635.    {
  636.        $this->SC_nowrap "";
  637.    }
  638.    else
  639.    {
  640.        $this->SC_nowrap "";
  641.    }
  642.    $SC_Label = (isset($this->New_label['veiculos_cor'])) ? $this->New_label['veiculos_cor'] : "Cor"
  643.    $conteudo trim(sc_strip_script($this->veiculos_cor)); 
  644.           if ($conteudo === ""
  645.           { 
  646.               $conteudo "&nbsp;" 
  647.           } 
  648.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_veiculos_cor_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  649.    $nm_saida->saida("    <TD class=\"scGridFieldOddVert css_veiculos_cor_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  650.    $nm_saida->saida("   \r\n");
  651.    $nm_saida->saida("  </TR>\r\n");
  652.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  653.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  654.    {
  655.        $this->SC_nowrap "";
  656.    }
  657.    else
  658.    {
  659.        $this->SC_nowrap "";
  660.    }
  661.    $SC_Label = (isset($this->New_label['veiculos_placa'])) ? $this->New_label['veiculos_placa'] : "Placa"
  662.    $conteudo trim(sc_strip_script($this->veiculos_placa)); 
  663.           if ($conteudo === ""
  664.           { 
  665.               $conteudo "&nbsp;" 
  666.           } 
  667.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_veiculos_placa_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  668.    $nm_saida->saida("    <TD class=\"scGridFieldEvenVert css_veiculos_placa_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  669.    $nm_saida->saida("   \r\n");
  670.    $nm_saida->saida("  </TR>\r\n");
  671.    $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
  672.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  673.    {
  674.        $this->SC_nowrap "NOWRAP";
  675.    }
  676.    else
  677.    {
  678.        $this->SC_nowrap "NOWRAP";
  679.    }
  680.    $SC_Label = (isset($this->New_label['veiculos_idproprietario_fk'])) ? $this->New_label['veiculos_idproprietario_fk'] : "Id Proprietario Fk"
  681.    $conteudo trim(NM_encode_input(sc_strip_script($this->veiculos_idproprietario_fk))); 
  682.           if ($conteudo === ""
  683.           { 
  684.               $conteudo "&nbsp;" 
  685.           } 
  686.           else    
  687.           { 
  688.               nmgp_Form_Num_Val($conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  689.           } 
  690.    $nm_saida->saida("    <TD class=\"scGridLabelFont css_veiculos_idproprietario_fk_det_label\"  >" nl2br($SC_Label) . "</TD>\r\n");
  691.    $nm_saida->saida("    <TD class=\"scGridFieldOddVert css_veiculos_idproprietario_fk_det_line\"  " $this->SC_nowrap " ALIGN=\"\" VALIGN=\"\">" $conteudo "</TD>\r\n");
  692.    $nm_saida->saida("   \r\n");
  693.    $nm_saida->saida("  </TR>\r\n");
  694.    $nm_saida->saida("</TABLE>\r\n");
  695.    if(isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])
  696.    {
  697.    }
  698.    $rs->Close(); 
  699.    $nm_saida->saida("  </td>\r\n");
  700.    $nm_saida->saida(" </tr>\r\n");
  701.    $nm_saida->saida(" </table>\r\n");
  702.    $nm_saida->saida(" </div>\r\n");
  703.    $nm_saida->saida("  </td>\r\n");
  704.    $nm_saida->saida(" </tr>\r\n");
  705.    $nm_saida->saida(" </table>\r\n");
  706.    $nm_saida->saida("  </td>\r\n");
  707.    $nm_saida->saida(" </tr>\r\n");
  708.    $nm_saida->saida(" </table>\r\n");
  709.    $nm_saida->saida(" </div>\r\n");
  710.    $nm_saida->saida("  </td>\r\n");
  711.    $nm_saida->saida(" </tr>\r\n");
  712.    $nm_saida->saida(" </table>\r\n");
  713. //--- 
  714. //--- 
  715.    $nm_saida->saida("<form name=\"F3\" method=post\r\n");
  716.    $nm_saida->saida("                  target=\"_self\"\r\n");
  717.    $nm_saida->saida("                  action=\"./\">\r\n");
  718.    $nm_saida->saida("<input type=hidden name=\"nmgp_opcao\" value=\"igual\"/>\r\n");
  719.    $nm_saida->saida("<input type=hidden name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/>\r\n");
  720.    $nm_saida->saida("<input type=hidden name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/>\r\n");
  721.    $nm_saida->saida("</form>\r\n");
  722.    $nm_saida->saida("<form name=\"F6\" method=\"post\" \r\n");
  723.    $nm_saida->saida("                  action=\"./\" \r\n");
  724.    $nm_saida->saida("                  target=\"_self\" style=\"display: none\"> \r\n");
  725.    $nm_saida->saida(" <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  726.    $nm_saida->saida(" <input type=\"hidden\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/> \r\n");
  727.    $nm_saida->saida("</form> \r\n");
  728.    $nm_saida->saida("<form name=\"Fprint\" method=\"post\" \r\n");
  729.    $nm_saida->saida("                  action=\"grid_new_iframe_prt.php\" \r\n");
  730.    $nm_saida->saida("                  target=\"jan_print\" style=\"display: none\"> \r\n");
  731.    $nm_saida->saida(" <input type=\"hidden\" name=\"path_botoes\" value=\"" $this->Ini->path_botoes "\"/> \r\n");
  732.    $nm_saida->saida(" <input type=\"hidden\" name=\"opcao\" value=\"det_print\"/>\r\n");
  733.    $nm_saida->saida(" <input type=\"hidden\" name=\"nmgp_opcao\" value=\"det_print\"/>\r\n");
  734.    $nm_saida->saida(" <input type=\"hidden\" name=\"cor_print\" value=\"CO\"/>\r\n");
  735.    $nm_saida->saida(" <input type=\"hidden\" name=\"nmgp_cor_print\" value=\"CO\"/>\r\n");
  736.    $nm_saida->saida(" <input type=\"hidden\" name=\"nmgp_password\" value=\"\"/>\r\n");
  737.    $nm_saida->saida(" <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  738.    $nm_saida->saida(" <input type=\"hidden\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/> \r\n");
  739.    $nm_saida->saida("</form> \r\n");
  740.    $nm_saida->saida("<script language=JavaScript>\r\n");
  741.    $nm_saida->saida("   function nm_submit_modal(parms, t_parent) \r\n");
  742.    $nm_saida->saida("   { \r\n");
  743.    $nm_saida->saida("      if (t_parent == 'S' && typeof parent.tb_show == 'function')\r\n");
  744.    $nm_saida->saida("      { \r\n");
  745.    $nm_saida->saida("           parent.tb_show('', parms, '');\r\n");
  746.    $nm_saida->saida("      } \r\n");
  747.    $nm_saida->saida("      else\r\n");
  748.    $nm_saida->saida("      { \r\n");
  749.    $nm_saida->saida("         tb_show('', parms, '');\r\n");
  750.    $nm_saida->saida("      } \r\n");
  751.    $nm_saida->saida("   } \r\n");
  752.    $nm_saida->saida("   function nm_move(tipo) \r\n");
  753.    $nm_saida->saida("   { \r\n");
  754.    $nm_saida->saida("      document.F6.target = \"_self\"; \r\n");
  755.    $nm_saida->saida("      document.F6.submit() ;\r\n");
  756.    $nm_saida->saida("      return;\r\n");
  757.    $nm_saida->saida("   } \r\n");
  758.    $nm_saida->saida("   function nm_mostra_doc(campo1)\r\n");
  759.    $nm_saida->saida("   {\r\n");
  760.    $nm_saida->saida("       NovaJanela = window.open (\"grid_new_doc.php?nmgp_parms=\" + campo1, \"ScriptCase\", \"resizable\");\r\n");
  761.    $nm_saida->saida("   }\r\n");
  762.    $nm_saida->saida("   function nm_gp_move(x, y, z, p, g, crt, ajax, chart_level, page_break_pdf, SC_module_export, use_pass_pdf, pdf_all_cab, pdf_all_label, pdf_label_group, pdf_zip) \r\n");
  763.    $nm_saida->saida("   {\r\n");
  764.    $nm_saida->saida("       if (\"pdf_det\" == x && \"S\" == ajax)\r\n");
  765.    $nm_saida->saida("       {\r\n");
  766.    $nm_saida->saida("           $('#TB_window').remove();\r\n");
  767.    $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
  768.    $nm_saida->saida("               nm_submit_modal(\"" $this->Ini->path_link "grid_new/grid_new_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=pdf_det&sAdd=__E__nmgp_tipo_pdf=\" + z + \"__E__sc_parms_pdf=\" + p + \"__E__sc_create_charts=\" + crt + \"__E__sc_graf_pdf=\" + g + \"__E__chart_level=\" + chart_level + \"__E__Det_use_pass_pdf=\" + use_pass_pdf + \"__E__Det_pdf_zip=\" + pdf_zip + \"&nm_opc=pdf_det&KeepThis=true&TB_iframe=true&modal=true\", '');\r\n");
  769.    $nm_saida->saida("       }\r\n");
  770.    $nm_saida->saida("       else\r\n");
  771.    $nm_saida->saida("       {\r\n");
  772.    $nm_saida->saida("           window.location = \"" $this->Ini->path_link "grid_new/index.php?nmgp_opcao=pdf_det&nmgp_tipo_pdf=\" + z + \"&nmgp_parms_pdf=\" + p +  \"&nmgp_graf_pdf=\" + g + \"&Det_use_pass_pdf=\" + use_pass_pdf + \"&Det_pdf_zip=\" + pdf_zip + \"&script_case_init=" NM_encode_input($this->Ini->sc_page) . "&script_case_session=" session_id() . "\";\r\n");
  773.    $nm_saida->saida("       }\r\n");
  774.    $nm_saida->saida("   }\r\n");
  775.    $nm_saida->saida("   function nm_gp_print_conf(tp, cor, res_cons, password, ajax, str_type, bol_param)\r\n");
  776.    $nm_saida->saida("   {\r\n");
  777.    $nm_saida->saida("       if (\"D\" == ajax)\r\n");
  778.    $nm_saida->saida("       {\r\n");
  779.    $nm_saida->saida("           $('#TB_window').remove();\r\n");
  780.    $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
  781.    $nm_saida->saida("               nm_submit_modal(\"" $this->Ini->path_link "grid_new/grid_new_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\"+ str_type +\"&sAdd=__E__nmgp_tipo_print=\" + tp + \"__E__nmgp_cor_print=\" + cor + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
  782.    $nm_saida->saida("       }\r\n");
  783.    $nm_saida->saida("       else\r\n");
  784.    $nm_saida->saida("       {\r\n");
  785.    $nm_saida->saida("          document.Fprint.nmgp_password.value = password;\r\n");
  786.    $nm_saida->saida("          document.Fprint.cor_print.value = cor;\r\n");
  787.    $nm_saida->saida("          document.Fprint.nmgp_cor_print.value = cor;\r\n");
  788.    $nm_saida->saida("          if (password != \"\")\r\n");
  789.    $nm_saida->saida("          {\r\n");
  790.    $nm_saida->saida("              document.Fprint.action=\"./\";\r\n");
  791.    $nm_saida->saida("              document.Fprint.target=\"_self\";\r\n");
  792.    $nm_saida->saida("          }\r\n");
  793.    $nm_saida->saida("          else\r\n");
  794.    $nm_saida->saida("          {\r\n");
  795.    $nm_saida->saida("              window.open('','jan_print','location=no,menubar=no,resizable,scrollbars,status=no,toolbar=no');\r\n");
  796.    $nm_saida->saida("          }\r\n");
  797.    $nm_saida->saida("          document.Fprint.submit() ;\r\n");
  798.    $nm_saida->saida("      }\r\n");
  799.    $nm_saida->saida("   }\r\n");
  800.    $nm_saida->saida("   function process_hotkeys(hotkey)\r\n");
  801.    $nm_saida->saida("   {\r\n");
  802.    $nm_saida->saida("   return false;\r\n");
  803.    $nm_saida->saida("   }\r\n");
  804.    $nm_saida->saida("</script>\r\n");
  805.    $nm_saida->saida("</body>\r\n");
  806.    $nm_saida->saida("</html>\r\n");
  807.  }
  808.    function nmgp_barra_det_top_normal()
  809.    {
  810.       global $nm_saida;
  811.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['det_print'] != "print" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_det']) 
  812.    { 
  813.        $nm_saida->saida("   <tr><td class=\"scGridTabelaTd\">\r\n");
  814.        $nm_saida->saida("    <table class=\"scGridToolbar\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;\" valign=\"top\" width=\"100%\"><tr>\r\n");
  815.        $nm_saida->saida("     <td class=\"scGridToolbarPadding\" nowrap valign=\"middle\" align=\"left\" width=\"33%\">\r\n");
  816.        $nm_saida->saida("         </td> \r\n");
  817.        $nm_saida->saida("          <td class=\"scGridToolbarPadding\" nowrap valign=\"middle\" align=\"center\" width=\"33%\"> \r\n");
  818.        if ($this->nmgp_botoes['det_pdf'] == "on")
  819.        {
  820.          $Cod_Btn nmButtonOutput($this->arr_buttons"bpdf""""""Dpdf_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_pdf.php?nm_opc=pdf_det&nm_target=0&nm_cor=cor&papel=8&orientacao=1&largura=1200&conf_larg=S&conf_fonte=10&language=en_us&conf_socor=N&sc_ver_93=" "&password=n&pdf_zip=N&KeepThis=false&TB_iframe=true&modal=true""""only_text""text_right""""""""""""""");
  821.          $nm_saida->saida("           $Cod_Btn \r\n");
  822.        }
  823.        if ($this->nmgp_botoes['det_print'] == "on")
  824.        {
  825.          $Cod_Btn nmButtonOutput($this->arr_buttons"bprint""""""Dprint_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_print.php?nm_opc=detalhe&nm_cor=CO&password=n&language=en_us&KeepThis=true&TB_iframe=true&modal=true""""only_text""text_right""""""""""""""");
  826.          $nm_saida->saida("           $Cod_Btn \r\n");
  827.        }
  828.        $Cod_Btn nmButtonOutput($this->arr_buttons"bvoltar""document.F3.submit();""document.F3.submit();""sc_b_sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  829.        $nm_saida->saida("           $Cod_Btn \r\n");
  830.        $nm_saida->saida("         </td> \r\n");
  831.        $nm_saida->saida("          <td class=\"scGridToolbarPadding\" nowrap valign=\"middle\" align=\"right\" width=\"33%\"> \r\n");
  832.        $nm_saida->saida("     </td>\r\n");
  833.        $nm_saida->saida("    </tr></table>\r\n");
  834.        $nm_saida->saida("   </td></tr>\r\n");
  835.    } 
  836.    }
  837.    function nmgp_barra_det_top_mobile()
  838.    {
  839.       global $nm_saida;
  840.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['det_print'] != "print" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_det']) 
  841.    { 
  842.        $nm_saida->saida("   <tr><td class=\"scGridTabelaTd\">\r\n");
  843.        $nm_saida->saida("    <table class=\"scGridToolbar\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;\" valign=\"top\" width=\"100%\"><tr>\r\n");
  844.        $nm_saida->saida("     <td class=\"scGridToolbarPadding\" nowrap valign=\"middle\" align=\"left\" width=\"33%\">\r\n");
  845.        if ($this->nmgp_botoes['det_pdf'] == "on")
  846.        {
  847.          $Cod_Btn nmButtonOutput($this->arr_buttons"bpdf""""""Dpdf_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_pdf.php?nm_opc=pdf_det&nm_target=0&nm_cor=cor&papel=8&orientacao=1&largura=1200&conf_larg=S&conf_fonte=10&language=en_us&conf_socor=N&sc_ver_93=" "&password=n&pdf_zip=N&KeepThis=false&TB_iframe=true&modal=true""""only_text""text_right""""""""""""""");
  848.          $nm_saida->saida("           $Cod_Btn \r\n");
  849.        }
  850.        if ($this->nmgp_botoes['det_print'] == "on")
  851.        {
  852.          $Cod_Btn nmButtonOutput($this->arr_buttons"bprint""""""Dprint_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_print.php?nm_opc=detalhe&nm_cor=CO&password=n&language=en_us&KeepThis=true&TB_iframe=true&modal=true""""only_text""text_right""""""""""""""");
  853.          $nm_saida->saida("           $Cod_Btn \r\n");
  854.        }
  855.        $Cod_Btn nmButtonOutput($this->arr_buttons"bvoltar""document.F3.submit();""document.F3.submit();""sc_b_sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  856.        $nm_saida->saida("           $Cod_Btn \r\n");
  857.        $nm_saida->saida("     </td>\r\n");
  858.        $nm_saida->saida("    </tr></table>\r\n");
  859.        $nm_saida->saida("   </td></tr>\r\n");
  860.    } 
  861.    }
  862.    function nm_gera_mask(&$nm_campo$nm_mask)
  863.    { 
  864.       $trab_campo $nm_campo;
  865.       $trab_mask  $nm_mask;
  866.       $tam_campo  strlen($nm_campo);
  867.       $trab_saida "";
  868.       $mask_num false;
  869.       for ($x=0$x strlen($trab_mask); $x++)
  870.       {
  871.           if (substr($trab_mask$x1) == "#")
  872.           {
  873.               $mask_num true;
  874.               break;
  875.           }
  876.       }
  877.       if ($mask_num )
  878.       {
  879.           $ver_duas explode(";"$trab_mask);
  880.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  881.           {
  882.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  883.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  884.               if ($cont2 >= $tam_campo)
  885.               {
  886.                   $trab_mask $ver_duas[1];
  887.               }
  888.               else
  889.               {
  890.                   $trab_mask $ver_duas[0];
  891.               }
  892.           }
  893.           $tam_mask strlen($trab_mask);
  894.           $xdados 0;
  895.           for ($x=0$x $tam_mask$x++)
  896.           {
  897.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  898.               {
  899.                   $trab_saida .= substr($trab_campo$xdados1);
  900.                   $xdados++;
  901.               }
  902.               elseif ($xdados $tam_campo)
  903.               {
  904.                   $trab_saida .= substr($trab_mask$x1);
  905.               }
  906.           }
  907.           if ($xdados $tam_campo)
  908.           {
  909.               $trab_saida .= substr($trab_campo$xdados);
  910.           }
  911.           $nm_campo $trab_saida;
  912.           return;
  913.       }
  914.       for ($ix strlen($trab_mask); $ix 0$ix--)
  915.       {
  916.            $char_mask substr($trab_mask$ix 11);
  917.            if ($char_mask != "x" && $char_mask != "z")
  918.            {
  919.                $trab_saida $char_mask $trab_saida;
  920.            }
  921.            else
  922.            {
  923.                if ($tam_campo != 0)
  924.                {
  925.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  926.                    $tam_campo--;
  927.                }
  928.                else
  929.                {
  930.                    $trab_saida "0" $trab_saida;
  931.                }
  932.            }
  933.       }
  934.       if ($tam_campo != 0)
  935.       {
  936.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  937.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  938.       }
  939.    
  940.       $iz 0
  941.       for ($ix 0$ix strlen($trab_mask); $ix++)
  942.       {
  943.            $char_mask substr($trab_mask$ix1);
  944.            if ($char_mask != "x" && $char_mask != "z")
  945.            {
  946.                if ($char_mask == "." || $char_mask == ",")
  947.                {
  948.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  949.                }
  950.                else
  951.                {
  952.                    $iz++;
  953.                }
  954.            }
  955.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  956.            {
  957.                $ix strlen($trab_mask) + 1;
  958.            }
  959.            else
  960.            {
  961.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  962.            }
  963.       }
  964.       $nm_campo $trab_saida;
  965.    } 
  966.    function nm_conv_data_db($dt_in$form_in$form_out)
  967.    {
  968.        $dt_out $dt_in;
  969.        if (strtoupper($form_in) == "DB_FORMAT")
  970.        {
  971.            if ($dt_out == "null" || $dt_out == "")
  972.            {
  973.                $dt_out "";
  974.                return $dt_out;
  975.            }
  976.            $form_in "AAAA-MM-DD";
  977.        }
  978.        if (strtoupper($form_out) == "DB_FORMAT")
  979.        {
  980.            if (empty($dt_out))
  981.            {
  982.                $dt_out "null";
  983.                return $dt_out;
  984.            }
  985.            $form_out "AAAA-MM-DD";
  986.        }
  987.        nm_conv_form_data($dt_out$form_in$form_out);
  988.        return $dt_out;
  989.    }
  990. }
Return
grid_new_det_ltr.css
  1. .css_proprietarios_idproprietario_det_label {text-align: left;vertical-align: middle;}
  2. .css_proprietarios_idproprietario_det_line {height:0px;text-align: left;}
  3. .css_proprietarios_nome_det_label {text-align: left;vertical-align: middle;}
  4. .css_proprietarios_nome_det_line {height:0px;text-align: left;}
  5. .css_proprietarios_sexo_det_label {text-align: left;vertical-align: middle;}
  6. .css_proprietarios_sexo_det_line {height:0px;text-align: left;}
  7. .css_proprietarios_cpf_det_label {text-align: left;vertical-align: middle;}
  8. .css_proprietarios_cpf_det_line {height:0px;text-align: left;}
  9. .css_proprietarios_endereco_det_label {text-align: left;vertical-align: middle;}
  10. .css_proprietarios_endereco_det_line {height:0px;text-align: left;}
  11. .css_proprietarios_telefone_det_label {text-align: left;vertical-align: middle;}
  12. .css_proprietarios_telefone_det_line {height:0px;text-align: left;}
  13. .css_proprietarios_curso_det_label {text-align: left;vertical-align: middle;}
  14. .css_proprietarios_curso_det_line {height:0px;text-align: left;}
  15. .css_proprietarios_cod_det_label {text-align: left;vertical-align: middle;}
  16. .css_proprietarios_cod_det_line {height:0px;text-align: left;}
  17. .css_proprietarios_sat_det_label {text-align: left;vertical-align: middle;}
  18. .css_proprietarios_sat_det_line {height:0px;text-align: left;}
  19. .css_veiculos_idveiculos_det_label {text-align: left;vertical-align: middle;}
  20. .css_veiculos_idveiculos_det_line {height:0px;text-align: left;}
  21. .css_veiculos_anomodelo_det_label {text-align: left;vertical-align: middle;}
  22. .css_veiculos_anomodelo_det_line {height:0px;text-align: left;}
  23. .css_veiculos_marca_det_label {text-align: left;vertical-align: middle;}
  24. .css_veiculos_marca_det_line {height:0px;text-align: left;}
  25. .css_veiculos_cor_det_label {text-align: left;vertical-align: middle;}
  26. .css_veiculos_cor_det_line {height:0px;text-align: left;}
  27. .css_veiculos_placa_det_label {text-align: left;vertical-align: middle;}
  28. .css_veiculos_placa_det_line {height:0px;text-align: left;}
  29. .css_veiculos_idproprietario_fk_det_label {text-align: left;vertical-align: middle;}
  30. .css_veiculos_idproprietario_fk_det_line {height:0px;text-align: left;}
Return
grid_new_det_rtl.css
  1. .css_proprietarios_idproprietario_det_label {text-align: right;vertical-align: middle;}
  2. .css_proprietarios_idproprietario_det_line {height:0px;text-align: right;}
  3. .css_proprietarios_nome_det_label {text-align: right;vertical-align: middle;}
  4. .css_proprietarios_nome_det_line {height:0px;text-align: right;}
  5. .css_proprietarios_sexo_det_label {text-align: right;vertical-align: middle;}
  6. .css_proprietarios_sexo_det_line {height:0px;text-align: right;}
  7. .css_proprietarios_cpf_det_label {text-align: right;vertical-align: middle;}
  8. .css_proprietarios_cpf_det_line {height:0px;text-align: right;}
  9. .css_proprietarios_endereco_det_label {text-align: right;vertical-align: middle;}
  10. .css_proprietarios_endereco_det_line {height:0px;text-align: right;}
  11. .css_proprietarios_telefone_det_label {text-align: right;vertical-align: middle;}
  12. .css_proprietarios_telefone_det_line {height:0px;text-align: right;}
  13. .css_proprietarios_curso_det_label {text-align: right;vertical-align: middle;}
  14. .css_proprietarios_curso_det_line {height:0px;text-align: right;}
  15. .css_proprietarios_cod_det_label {text-align: right;vertical-align: middle;}
  16. .css_proprietarios_cod_det_line {height:0px;text-align: right;}
  17. .css_proprietarios_sat_det_label {text-align: right;vertical-align: middle;}
  18. .css_proprietarios_sat_det_line {height:0px;text-align: right;}
  19. .css_veiculos_idveiculos_det_label {text-align: right;vertical-align: middle;}
  20. .css_veiculos_idveiculos_det_line {height:0px;text-align: right;}
  21. .css_veiculos_anomodelo_det_label {text-align: right;vertical-align: middle;}
  22. .css_veiculos_anomodelo_det_line {height:0px;text-align: right;}
  23. .css_veiculos_marca_det_label {text-align: right;vertical-align: middle;}
  24. .css_veiculos_marca_det_line {height:0px;text-align: right;}
  25. .css_veiculos_cor_det_label {text-align: right;vertical-align: middle;}
  26. .css_veiculos_cor_det_line {height:0px;text-align: right;}
  27. .css_veiculos_placa_det_label {text-align: right;vertical-align: middle;}
  28. .css_veiculos_placa_det_line {height:0px;text-align: right;}
  29. .css_veiculos_idproprietario_fk_det_label {text-align: right;vertical-align: middle;}
  30. .css_veiculos_idproprietario_fk_det_line {height:0px;text-align: right;}
Return
grid_new_download.php
  1. <?php
  2.    session_cache_limiter("");

  3.    session_start();

  4.    if (!empty($_GET))
  5.    {
  6.        foreach ($_GET as $nmgp_var => $nmgp_val)
  7.        {
  8.             $$nmgp_var $nmgp_val;
  9.        }
  10.    }

  11.    if (isset($script_case_init) && isset($nm_tit_doc) && isset($nm_name_doc) && isset($_SESSION['sc_session'][$script_case_init][$nm_tit_doc][$nm_name_doc]))
  12.    {
  13.        $nm_name_doc_ok $_SESSION['sc_session'][$script_case_init][$nm_tit_doc][$nm_name_doc][0];
  14.        $nm_tit_doc_ok  $_SESSION['sc_session'][$script_case_init][$nm_tit_doc][$nm_name_doc][1];
  15.    }
  16.    else
  17.    {
  18.        echo "<html>";
  19.        echo "<body>";
  20.        echo "<table align=\"center\" width=\"50%\" border=1 height=\"50px\">";
  21.        echo "<tr>";
  22.        echo "   <td align=\"center\">";
  23.        echo "       <b><font size=4>" $_SESSION['sc_session']['SC_download_violation'] . "</font>";
  24.        echo "   </b></td>";
  25.        echo " </tr>";
  26.        echo "</table>";
  27.        echo "</body>";
  28.        echo "</html>";
  29.        exit;
  30.    }

  31.    $NM_dir_atual getcwd();
  32.    if (empty($NM_dir_atual))
  33.    {
  34.       $str_path_sys    = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  35.       $str_path_sys    str_replace("\\"'/'$str_path_sys);
  36.    }
  37.    else
  38.    {
  39.        $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  40.        $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  41.    }
  42.    $str_path_web  $_SERVER['PHP_SELF'];
  43.    $str_path_web  str_replace("\\"'/'$str_path_web);
  44.    $root          substr($str_path_sys0, -strlen($str_path_web));

  45.    header("Content-type: application/force-download");
  46.    header("Content-Disposition: attachment; filename=$nm_tit_doc_ok");
  47.    readfile($root $nm_name_doc_ok);
  48.    exit;
  49. ?>
Return
grid_new_erro.class.php
  1. <?php

  2. class grid_new_erro
  3. {
  4.    var $Ini;

  5.    var $script;
  6.    var $linha;
  7.    var $tipo;
  8.    var $mensagem;
  9.    var $complemento;
  10.    var $msg_final;

  11.    //----- 
  12.    function __construct()
  13.    {
  14.       $this->script      "";
  15.       $this->linha       "";
  16.       $this->tipo        "";
  17.       $this->mensagem    "";
  18.       $this->complemento "";
  19.       $this->msg_final   "";
  20.    }

  21.    //----- 
  22.    function mensagem($script$linha$tipo$mensagem$complemento ""$exibe true)
  23.    {
  24.       $this->script      $script;
  25.       $this->linha       $linha;
  26.       $this->tipo        strtolower($tipo);
  27.       $this->mensagem    trim($mensagem);
  28.       $this->complemento trim($complemento);
  29.       if (isset($this->Ini->nm_bases_mssql) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql) && strtoupper(substr(PHP_OS03)) !== 'WIN' && $this->tipo == 'banco' && empty($this->complemento))
  30.       {
  31.           return false;
  32.       }
  33.       $this->monta_mensagem();
  34.       return scriptcase_error_handler(E_USER_ERROR$this->msg_final$script$linha$exibe);
  35.    }

  36.    //----- 
  37.    function monta_mensagem()
  38.    {
  39.       $mensagem NM_encode_input($this->mensagem);
  40.       if ("banco" == $this->tipo)
  41.       {
  42.          $mensagem .= "<BR>" NM_encode_input($this->complemento);
  43.       $mensagem .= "<BR>" NM_encode_input($_SESSION['scriptcase']['sc_sql_ult_comando']);
  44.       }
  45.       $this->msg_final $mensagem;
  46.    }

  47. }

  48. ?>
Return
grid_new_erro.php
  1. <?php

  2. error_reporting(E_ALL);
  3. $old_error_handler set_error_handler("scriptcase_error_handler");

  4. function scriptcase_error_handler($err_no$err_msg$err_file$err_line$exibe)
  5. {
  6.     $errors_handled = array(
  7.                             E_ERROR,
  8.                             E_PARSE,
  9.                             E_CORE_ERROR,
  10.                             E_CORE_WARNING,
  11.                             E_COMPILE_ERROR,
  12.                             E_COMPILE_WARNING,
  13.                             E_USER_ERROR,
  14.                             E_USER_WARNING,
  15.                             E_USER_NOTICE
  16.                            );
  17.     if (isset($_SESSION['scriptcase']['grid_new']['contr_erro']) && $_SESSION['scriptcase']['grid_new']['contr_erro'] == 'on')
  18.     {
  19.         $errors_handled[] = E_WARNING;
  20.         $errors_handled[] = E_NOTICE;
  21.     }
  22.     if (in_array($err_no$errors_handled))
  23.     {
  24.         $msg      "";
  25.         $tmp_desc "";
  26.         $bol_flag TRUE;
  27.         // ADO
  28.         if (FALSE !== strpos($err_msg"Invoke() failed") && isset($_SESSION['scriptcase']['sc_sql_ult_conexao']) && !empty($_SESSION['scriptcase']['sc_sql_ult_conexao']))
  29.         {
  30.             $tmp_desc $_SESSION['scriptcase']['sc_sql_ult_conexao'];
  31.         }
  32.         $msg .= ("" != $tmp_desc) ? trim($tmp_desc) : trim($err_msg);
  33.         if (FALSE !== strpos($err_msg"Invoke() failed") && "" != $_SESSION['scriptcase']['sc_sql_ult_comando'])
  34.         {
  35.             $msg .= "<BR>";
  36.             $msg .= "<BR>";
  37.             $msg .= "<B>SQL</B>: ";
  38.             $msg .= $_SESSION['scriptcase']['sc_sql_ult_comando'];
  39.         }
  40.         // e-mail
  41.         if (FALSE !== strpos($err_msg"SSL: fatal protocol error"))
  42.         {
  43.             $bol_flag FALSE;
  44.         }
  45.         // Application Roles
  46.         if (FALSE !== strpos($err_msg"The application role "))
  47.         {
  48.             $bol_flag FALSE;
  49.         }
  50.         // DBF
  51.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"Optional feature not implemented"))
  52.         {
  53.             $bol_flag FALSE;
  54.         }
  55.         // Sqlserver
  56.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"The command(s) completed successfully"))
  57.         {
  58.             $bol_flag FALSE;
  59.         }
  60.         // InterBase
  61.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"InterBase: conversion error from string") && isset($GLOBALS["NM_ERRO_IBASE"]) && == $GLOBALS["NM_ERRO_IBASE"])
  62.         {
  63.             $bol_flag FALSE;
  64.         }
  65.         // PostGreSQL
  66.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"pg_fetch_array(): Unable to jump to row"))
  67.         {
  68.             $bol_flag FALSE;
  69.         }
  70.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"Changed database context to "))
  71.         {
  72.             $bol_flag FALSE;
  73.         }
  74.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"Creating default object from empty value"))
  75.         {
  76.             $bol_flag FALSE;
  77.         }
  78.         // Arquivo
  79.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"stat failed for"))
  80.         {
  81.             $bol_flag FALSE;
  82.         }
  83.         // currency
  84.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"currency type not supported by PHP"))
  85.         {
  86.             $bol_flag FALSE;
  87.         }
  88.         // PHP4
  89.         if (FALSE !== strpos($err_msg"Assigning the return value of new by reference is deprecated"))
  90.         {
  91.             $bol_flag FALSE;
  92.         }
  93.         if (FALSE !== strpos($err_msg"var Deprecated Please use the"))
  94.         {
  95.             $bol_flag FALSE;
  96.         }
  97.         if (FALSE !== strpos($err_msg"var: Deprecated. Please use the"))
  98.         {
  99.             $bol_flag FALSE;
  100.         }
  101.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"Only variable references should be returned by reference"))
  102.         {
  103.             $bol_flag FALSE;
  104.         }
  105.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos(strtolower($err_msg), "unable to bind to server"))
  106.         {
  107.             $bol_flag FALSE;
  108.         }
  109.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"Only variables should be assigned by reference"))
  110.         {
  111.             $bol_flag FALSE;
  112.         }
  113.         // Diretorio
  114.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && FALSE !== strpos($err_msg"MkDir"))
  115.         {
  116.             $bol_flag FALSE;
  117.         }
  118.         // Formulas PHP
  119.         if ((E_WARNING == $err_no || E_NOTICE == $err_no) && (FALSE !== strpos($err_msg"sc_proc_quebra_") || FALSE !== strpos($err_msg"sc_proc_grid")))
  120.         {
  121.             $bol_flag FALSE;
  122.         }
  123.         // Geral
  124.         if (FALSE !== strpos($err_msg"set_time_limit"))
  125.         {
  126.             $bol_flag FALSE;
  127.         }
  128.         if (FALSE !== strpos(strtolower($err_msg), "the mysql extension is deprecated and will be removed in the future"))
  129.         {
  130.             $bol_flag FALSE;
  131.         }
  132.         if (FALSE !== strpos(strtolower($err_msg), "driver doesn't support meta data"))
  133.         {
  134.             $bol_flag FALSE;
  135.         }
  136.         if ($bol_flag && $exibe)
  137.         {
  138.             scriptcase_error_display($msg$err_no);
  139.         }
  140.         $_SESSION['scriptcase']['erro_handler'] = $bol_flag;
  141.         return;
  142.     }
  143. }

  144. function scriptcase_error_display($err_msg$err_no)
  145. {
  146.    $str_schema_all $_SESSION['scriptcase']['erro']['str_schema'];
  147.    $str_schema_dir $_SESSION['scriptcase']['erro']['str_schema_dir'];
  148.    $NM_arq_lang    "../_lib/lang/" $_SESSION['scriptcase']['erro']['str_lang'] . ".lang.php";
  149.    if (!function_exists("NM_is_utf8"))
  150.    {
  151.        include_once("../_lib/lib/php/nm_utf8.php");
  152.    }
  153.    $Nm_lang = array();
  154.    if (is_file($NM_arq_lang))
  155.    {
  156.        $Lixo file($NM_arq_lang);
  157.        foreach ($Lixo as $Cada_lin
  158.        {
  159.            if (strpos($Cada_lin"array()") === false && (trim($Cada_lin) != "<?php")  && (trim($Cada_lin) != "?" ">"))
  160.            {
  161.                eval (str_replace("\$this->""\$"$Cada_lin));
  162.            }
  163.        }
  164.    }
  165.    $_SESSION['scriptcase']['charset']  = (isset($Nm_lang['Nm_charset']) && !empty($Nm_lang['Nm_charset'])) ? $Nm_lang['Nm_charset'] : "UTF-8";
  166.    ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  167.    foreach ($Nm_lang as $ind => $dados)
  168.    {
  169.       if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($dados))
  170.       {
  171.           $Nm_lang[$ind] = sc_convert_encoding($dados$_SESSION['scriptcase']['charset'], "UTF-8");
  172.       }
  173.    }
  174. ?>
  175. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  176.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  177. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  178. <HEAD>
  179.  <TITLE></TITLE>
  180.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  181. <?php
  182.  if (isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])
  183.  {
  184. ?>
  185.     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  186. <?php
  187.  }
  188. ?>
  189.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
  190.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?>" GMT">
  191.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
  192.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0">
  193.  <META http-equiv="Pragma" content="no-cache">
  194. <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  195.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $str_schema_all ?>" /> 
  196.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $str_schema_dir ?>" /> 
  197. </HEAD>
  198. <BODY>
  199. <TABLE class="scErrorTable" cellspacing="0" cellpadding="0" align="center">
  200.  <TR>
  201.   <TD class="scErrorTitle" align="left"><?php echo $Nm_lang['lang_errm_errt']; ?></TD>
  202.  </TR>
  203.  <TR>
  204.   <TD class="scErrorMessage" align="center"><?php echo $err_msg?></TD>
  205.  </TR>
  206. </TABLE></BODY>
  207. </HTML>
  208. <?php
  209. }

  210. ?>
Return
grid_new_export_ctrl.php
  1. <?php
  2. @session_start() ;
  3. $_SESSION['scriptcase']['grid_new']['sc_process_barr'] = true;
  4. require_once('../grid_new/index.php');
  5. unset($_SESSION['scriptcase']['grid_new']['sc_process_barr']);
  6. $ExportCtrl = new grid_new_export_control;
  7. $ExportCtrl->Export_barr();

  8. class grid_new_export_control
  9. {
  10.    function Export_barr()
  11.    {
  12.       $NM_dir_atual getcwd();
  13.       if (empty($NM_dir_atual))
  14.       {
  15.           $str_path_sys    = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  16.           $str_path_sys    str_replace("\\"'/'$str_path_sys);
  17.       }
  18.       else
  19.       {
  20.           $sc_nm_arquivo   explode("/"$_SERVER['PHP_SELF']);
  21.           $str_path_sys    str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  22.       }
  23.       $str_path_web         $_SERVER['PHP_SELF'];
  24.       $str_path_web         str_replace("\\"'/'$str_path_web);
  25.       $str_path_web         str_replace('//''/'$str_path_web);
  26.       $this->root           substr($str_path_sys0, -strlen($str_path_web));
  27.       $this->path_link      substr($str_path_web0strrpos($str_path_web'/'));
  28.       $this->path_link      substr($this->path_link0strrpos($this->path_link'/')) . '/';
  29.       $this->path_btn       $this->root $this->path_link "_lib/buttons/";
  30.       $this->path_css       $this->root $this->path_link "_lib/css/";
  31.       $this->path_lib_php   $this->root $this->path_link "_lib/lib/php";
  32.       $this->path_botoes    $this->path_link "_lib/img";
  33.       $this->path_lang      "../_lib/lang/";
  34.       $this->path_prod      $_SESSION['scriptcase']['grid_new']['glo_nm_path_prod'];
  35.       $this->path_imag_temp $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'];
  36.       $script_case_init     $_REQUEST['script_case_init'];
  37.       if (!isset($_SESSION['scriptcase']['str_lang']) || empty($_SESSION['scriptcase']['str_lang']))
  38.       {
  39.           $_SESSION['scriptcase']['str_lang'] = "en_us";
  40.       }
  41.       if (!isset($_SESSION['scriptcase']['str_conf_reg']) || empty($_SESSION['scriptcase']['str_conf_reg']))
  42.       {
  43.           $_SESSION['scriptcase']['str_conf_reg'] = "pt_br";
  44.       }
  45.       $this->str_lang     $_SESSION['scriptcase']['str_lang'];
  46.       $this->str_conf_reg $_SESSION['scriptcase']['str_conf_reg'];
  47.       require_once($this->path_lang $this->str_lang ".lang.php");
  48.       require_once($this->path_lang "config_region.php");
  49.       require_once($this->path_lang "lang_config_region.php");
  50.       require_once($this->path_lib_php "/nm_gp_config_btn.php");
  51.       if (!function_exists("NM_is_utf8"))
  52.       {
  53.           include_once("../_lib/lib/php/nm_utf8.php");
  54.       }
  55.       asort($this->Nm_lang_conf_region);
  56.       $_SESSION['scriptcase']['reg_conf']['html_dir'] = (isset($this->Nm_conf_reg[$this->str_conf_reg]['ger_ltr_rtl'])) ? " DIR='" $this->Nm_conf_reg[$this->str_conf_reg]['ger_ltr_rtl'] . "'" "";
  57.       $_SESSION['scriptcase']['reg_conf']['css_dir']  = (isset($this->Nm_conf_reg[$this->str_conf_reg]['ger_ltr_rtl'])) ? $this->Nm_conf_reg[$this->str_conf_reg]['ger_ltr_rtl'] : "LTR";
  58.       $this->str_schema_all = (isset($_SESSION['scriptcase']['str_schema_all']) && !empty($_SESSION['scriptcase']['str_schema_all'])) ? $_SESSION['scriptcase']['str_schema_all'] : "Sc9_Midnight/Sc9_Midnight";
  59.       require_once("../_lib/css/" $this->str_schema_all "_grid.php");
  60.       $this->Str_btn_grid    trim($str_button) . "/" trim($str_button) . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".php";
  61.       $this->Str_btn_css     trim($str_button) . "/" trim($str_button) . ".css";
  62.       require_once($this->path_btn $this->Str_btn_grid);
  63.       $opc_export = (isset($_REQUEST['nmgp_opcao'])) ? $_REQUEST['nmgp_opcao'] : "";
  64.       $opc_export strtoupper(str_replace(array("doc_","_res"), array("",""), $opc_export));
  65.       require_once($this->path_lib_php "/sc_progress_bar.php");
  66.       $pb = new scProgressBar();
  67.       $pb->setRoot($this->root);
  68.       $pb->setDir($this->path_imag_temp "/");
  69.       $pb->createProgressbarMd5();
  70.       $pb->initialize();
  71.       $pb->setProgressbarTitle($this->Nm_lang['lang_btns_expt'] . " " $opc_export);
  72.       $Btn_view nmButtonOutput($this->arr_buttons"bexportview""viewClick()""viewClick()""idBtnView"""""""""""""$this->path_botoes"""""""""""only_text""text_right""""""""""""""");
  73. ;
  74.       $Btn_down nmButtonOutput($this->arr_buttons"bdownload""downloadClick()""downloadClick()""idBtnDown"""""""""""""$this->path_botoes"""""""""""only_text""text_right""""""""""""""");
  75. ;
  76.       $Btn_exit nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->path_botoes"""""""""""only_text""text_right""""""""""""""");
  77. ;
  78.       $pb->setButtons(array(
  79.           'view' => array(
  80.                     'id'   => 'idBtnView',
  81.                     'code' => $Btn_view,
  82.                     ),
  83.           'download' => array(
  84.                     'id'   => 'idBtnDown',
  85.                     'code' => $Btn_down,
  86.                     ),
  87.           'back' => array(
  88.                     'id'   => 'idBtnBack',
  89.                     'code' => $Btn_exit,
  90.                     ),
  91.       ));
  92. ?>
  93. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  94.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  95. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  96. <HEAD>
  97.  <TITLE><?php echo $this->Nm_lang['lang_othr_grid_title'?>  :: Excel</TITLE>
  98.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  99. <?php
  100. if ($_SESSION['scriptcase']['proc_mobile'])
  101. {
  102. ?>
  103.   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  104. <?php
  105. }
  106. ?>
  107.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  108.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  109.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  110.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  111.  <META http-equiv="Pragma" content="no-cache"/>
  112.  <META name="viewport" content="width=device-width, initial-scale=1"/>
  113.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  114.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->str_schema_all ?>_export.css" /> 
  115.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  116.  <link rel="stylesheet" href="<?php echo $this->path_prod ?>/third/font-awesome/css/all.min.css" type="text/css" media="screen" />
  117.  <?php
  118.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  119.  {
  120.  ?>
  121.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  122.  <?php
  123.  }
  124.  ?>
  125.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Str_btn_css ?>" /> 
  126.   <link rel="stylesheet" type="text/css" href="<?php echo $this->path_prod ?>/third/jquery/css/smoothness/jquery-ui.css" />
  127.   <script type="text/javascript" src="<?php echo $this->path_prod ?>/third/jquery/js/jquery.js"></script>
  128.   <script type="text/javascript" src="<?php echo $this->path_prod ?>/third/jquery/js/jquery-ui.js"></script>
  129.  <script>
  130.   <?php echo $pb->getJavascript(); ?>
  131.  </script>
  132. </HEAD>
  133. <BODY class="scExportPage">
  134.  <?php echo $pb->getHtml(); ?>
  135. <br />
  136. <iframe style="width: 1px; height: 1px; border-width: 0;" src="index.php?<?php echo $pb->getIframeParams(); ?>">
  137. </iframe>
  138. <form name="Fview" method="get" action="" target="_blank" style="display: none"> 
  139. </form>
  140. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  141. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($script_case_init); ?>"> 
  142. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  143. <input type="hidden" name="nm_name_doc" value=""> 
  144. </form>
  145. <FORM name="F0" method=post action=""> 
  146. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($script_case_init); ?>"> 
  147. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  148. <INPUT type="hidden" name="nmgp_opcao" value=""> 
  149. </FORM> 
  150. </BODY>
  151. </HTML>
  152.  <script type="text/javascript">
  153.  function viewClick() {
  154.     if ($("#idBtnView").prop("disabled")) {
  155.        return;
  156.     }
  157.     document.Fview.submit()
  158.  }
  159.  function downloadClick() {
  160.     if ($("#idBtnDown").prop("disabled")) {
  161.        return;
  162.     }
  163.     document.Fdown.submit()
  164.  }
  165. </script>
  166. <?php
  167.   }
  168. }
Return
grid_new_fil_ltr.css
Return
grid_new_fil_rtl.css
Return
grid_new_fim.php
  1. <?php
  2.    include_once('grid_new_session.php');
  3.    session_start();
  4.    if (!isset($_SESSION['sc_session']))
  5.    {
  6. ?>
  7.    <html>
  8.     <body>
  9.      <form name="F0" method=post
  10.                   target="_self"
  11.                   action="./">
  12.      </form>
  13.      <script type="text/javascript">
  14.         document.F0.submit();
  15.      </script>
  16.     </body>
  17.    </html>
  18. <?php
  19.      exit;
  20.    }
  21.    if (!function_exists("NM_is_utf8"))
  22.    {
  23.        include_once("../_lib/lib/php/nm_utf8.php");
  24.    }

  25. //----- 
  26.    if (!empty($_POST))
  27.    {
  28.        foreach ($_POST as $nmgp_var => $nmgp_val)
  29.        {
  30.             if (substr($nmgp_var011) == "SC_glo_par_")
  31.             {
  32.                 $nmgp_var substr($nmgp_var11);
  33.                 $nmgp_val $_SESSION[$nmgp_val];
  34.             }
  35.             if ($nmgp_var == "nmgp_parms" && substr($nmgp_val08) == "@SC_par@")
  36.             {
  37.                 $SC_Ind_Val explode("@SC_par@"$nmgp_val);
  38.                 $nmgp_val $_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['Lig_Md5'][$SC_Ind_Val[3]];
  39.             }
  40.             $$nmgp_var $nmgp_val;
  41.        }
  42.    }
  43.    if (!empty($_GET))
  44.    {
  45.        foreach ($_GET as $nmgp_var => $nmgp_val)
  46.        {
  47.             if (substr($nmgp_var011) == "SC_glo_par_")
  48.             {
  49.                 $nmgp_var substr($nmgp_var11);
  50.                 $nmgp_val $_SESSION[$nmgp_val];
  51.             }
  52.             if ($nmgp_var == "nmgp_parms" && substr($nmgp_val08) == "@SC_par@")
  53.             {
  54.                 $SC_Ind_Val explode("@SC_par@"$nmgp_val);
  55.                 $nmgp_val $_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['Lig_Md5'][$SC_Ind_Val[3]];
  56.             }
  57.             $$nmgp_var $nmgp_val;
  58.        }
  59.    }
  60.    if (!isset($script_case_init))
  61.    {
  62.       exit;
  63.    }
  64.    if (isset($_SESSION['session_sec_aplicacao']["Projeto7_____grid_new"]))
  65.    {
  66.       unset($_SESSION['session_sec_aplicacao']["Projeto7_____grid_new"]);
  67.    }

  68.    if (isset($_SESSION['session_sec_aplicacao']) && empty($_SESSION['session_sec_aplicacao']))
  69.    {
  70.       unset($_SESSION['session_sec_aplicacao']);
  71.       unset($_SESSION['session_sec_usuario']);
  72.    }
  73.    $fecha_janela false;
  74.    if (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan']) && $_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan'])
  75.    {
  76.        $fecha_janela true;
  77.    }
  78.    if ((isset($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['grid_new']['opc_psq']) && $_SESSION['sc_session'][$script_case_init]['grid_new']['opc_psq']) || $fecha_janela)
  79.    {
  80.        if (isset($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['grid_new']['sc_modal']) && $_SESSION['sc_session'][$script_case_init]['grid_new']['sc_modal'])
  81.        {
  82.            unset($_SESSION['sc_session'][$script_case_init]['grid_new']['sc_modal']);
  83.            $saida_final "self.parent.tb_remove()";
  84.        }
  85.        else
  86.        {
  87.            $saida_final "window.close()";
  88.        }
  89.        nm_limpa_arr_session();
  90. ?>
  91. <HTML>
  92. <HEAD>
  93.  <TITLE>grid_new</TITLE>
  94.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  95. <?php
  96.  if ($_SESSION['scriptcase']['proc_mobile'])
  97.  {
  98. ?>
  99.     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  100. <?php
  101.  }
  102. ?>
  103. </HEAD>
  104. <BODY>
  105. <SCRIPT LANGUAGE="Javascript">
  106.  <?php echo $saida_final?>;
  107. </SCRIPT>
  108. </BODY>
  109. </HTML>
  110. <?php
  111.    }
  112.    elseif (!isset($_SESSION['scriptcase']['sc_url_saida'][$script_case_init]) || empty($_SESSION['scriptcase']['sc_url_saida'][$script_case_init]))
  113.    {
  114.            nm_limpa_arr_session();
  115. ?>
  116. <HTML>
  117. <HEAD>
  118.  <TITLE>grid_new</TITLE>
  119.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  120. <?php
  121.  if ($_SESSION['scriptcase']['proc_mobile'])
  122.  {
  123. ?>
  124.     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  125. <?php
  126.  }
  127. ?>
  128. </HEAD>
  129. <BODY>
  130. <SCRIPT LANGUAGE="Javascript">
  131.   history.back();
  132. </SCRIPT>
  133. </BODY>
  134. </HTML>
  135. <?php
  136.    }
  137.    else
  138.    {
  139.        nm_limpa_arr_session();
  140. ?>
  141. <HTML>
  142. <HEAD>
  143.  <TITLE>grid_new</TITLE>
  144.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  145. <?php
  146.  if ($_SESSION['scriptcase']['proc_mobile'])
  147.  {
  148. ?>
  149.     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  150. <?php
  151.  }
  152. ?>
  153. </HEAD>
  154. <BODY>
  155. <form name="fsai" method="post" action="<?php echo $_SESSION['scriptcase']['sc_url_saida'][$script_case_init]; ?>">
  156. <input type=hidden name="script_case_init" value="<?php  echo NM_encode_input($script_case_init); ?>"> 
  157. <input type=hidden name="script_case_session" value="<?php  echo NM_encode_input(session_id()); ?>"> 
  158. </form>
  159. <SCRIPT LANGUAGE="Javascript">
  160.    nm_ver_saida = "<?php echo $_SESSION['scriptcase']['sc_url_saida'][$script_case_init]; ?>";
  161.    nm_ver_saida = nm_ver_saida.toLowerCase();
  162.    if (nm_ver_saida.substr(0, 4) != ".php" && (nm_ver_saida.substr(0, 7) == "http://" || nm_ver_saida.substr(0, 8) == "https://" || nm_ver_saida.substr(0, 3) == "../")) 
  163.    { 
  164.        window.location = ("<?php echo $_SESSION['scriptcase']['sc_url_saida'][$script_case_init]; ?>"); 
  165.    } 
  166.    else 
  167.    { 
  168.        document.fsai.submit();
  169.    } 
  170. </SCRIPT>
  171. </BODY>
  172. </HTML>
  173. <?php
  174.    }
  175.    function nm_limpa_arr_session()
  176.    {
  177.       global $script_case_init;
  178.       $achou false;
  179.       if (!isset($_SESSION['sc_session'][$script_case_init]) || !isset($script_case_init))
  180.       {
  181.           return;
  182.       }
  183.       if (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_filho']))
  184.       {
  185.           foreach ($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_filho'] as $ind => $sc_init)
  186.           {
  187.               unset($_SESSION['sc_session'][$sc_init]);
  188.           }
  189.       }
  190.       foreach ($_SESSION['sc_session'][$script_case_init] as $nome_apl => $resto)
  191.       {
  192.           if ($nome_apl == 'grid_new' || $achou)
  193.           {
  194.               unset($_SESSION['sc_session'][$script_case_init][$nome_apl]);
  195.               $achou true;
  196.           }
  197.       }
  198.       if (empty($_SESSION['sc_session'][$script_case_init]))
  199.       {
  200.           unset($_SESSION['sc_session'][$script_case_init]);
  201.       }
  202.    }
  203. ?>
Return
grid_new_gauge_ctrl.php
  1. <?php
  2. if (!isset($_GET['str_schema'])) {
  3.     exit;
  4. }
  5. if (!function_exists("NM_is_utf8"))
  6. {
  7.     include_once("../_lib/lib/php/nm_utf8.php");
  8. }
  9. $STR_schema  $_GET['str_schema'];
  10. $STR_lang    base64_decode($_GET['str_lang']);
  11. $NM_arq_lang "../_lib/lang/" $STR_lang ".lang.php";
  12.  $Nm_lang = array();
  13.  if (is_file($NM_arq_lang))
  14.  {
  15.      $Lixo file($NM_arq_lang);
  16.      foreach ($Lixo as $Cada_lin
  17.      {
  18.          if (strpos($Cada_lin"array()") === false && (trim($Cada_lin) != "<?php")  && (trim($Cada_lin) != "?" ">"))
  19.          {
  20.              eval (str_replace("\$this->""\$"$Cada_lin));
  21.          }
  22.      }
  23.  }
  24. $str_file base64_decode($_GET['pbfile']);
  25. if ('http' == substr($str_file04))
  26. {
  27.     exit;
  28. }
  29. $arr_data = @file($str_file);
  30. if ($arr_data && <= sizeof($arr_data))
  31. {
  32.     $bol_load TRUE;
  33.     $str_type trim($arr_data[0]);
  34.     $str_js   trim($arr_data[1]);
  35.     $str_img  trim($arr_data[2]);
  36.     $int_size trim($arr_data[3]);
  37.     $str_data trim($arr_data[sizeof($arr_data) - 1]);
  38.     $int_step '';
  39.     if ('off' == $str_data)
  40.     {
  41.         $bol_end TRUE;
  42.     }
  43.     elseif ('HDOC_#NM#_' == substr($str_data010))
  44.     {
  45.         $bol_end    FALSE;
  46.         $arr_partes explode('_#NM#_'$str_data);
  47.         if (== sizeof($arr_partes))
  48.         {
  49.             $str_msg  = ('F' == $arr_partes[1]) ? $Nm_lang['lang_pdff_frmt_page']  : $Nm_lang['lang_pdff_wrtg'];
  50.             $str_msg .= $arr_partes[2];
  51.             $int_step = ('F' == $arr_partes[1]) ? floor($int_size 0.9) : floor($int_size 0.95);
  52.         }
  53.         else
  54.         {
  55.             $bol_load FALSE;
  56.         }
  57.     }
  58.     else
  59.     {
  60.         $bol_end    FALSE;
  61.         $arr_partes explode('_#NM#_'$str_data);
  62.         if (== sizeof($arr_partes))
  63.         {
  64.             $int_step $arr_partes[0];
  65.             $str_msg  $arr_partes[1];
  66.         }
  67.         else
  68.         {
  69.             $bol_load FALSE;
  70.         }
  71.     }
  72.     echo $int_size '!#!' $int_step '!#!' . ($bol_end '1' '0') . '!#!' . ($bol_end $Nm_lang['lang_pdff_fnsh'] : $str_msg);
  73. }
  74. else
  75. {
  76.     $bol_end  FALSE;
  77.     $bol_load FALSE;
  78. }
  79. if ($bol_end)
  80. {
  81.     @unlink($str_file);
  82. }
  83. ?>
Return
grid_new_grid.class.php
  1. <?php
  2. class grid_new_grid
  3. {
  4.    var $Ini;
  5.    var $Erro;
  6.    var $Db;
  7.    var $Tot;
  8.    var $Lin_impressas;
  9.    var $Lin_final;
  10.    var $Rows_span;
  11.    var $NM_colspan;
  12.    var $rs_grid;
  13.    var $nm_grid_ini;
  14.    var $nm_grid_sem_reg;
  15.    var $nm_prim_linha;
  16.    var $Rec_ini;
  17.    var $Rec_fim;
  18.    var $nmgp_reg_start;
  19.    var $nmgp_reg_inicial;
  20.    var $nmgp_reg_final;
  21.    var $SC_seq_register;
  22.    var $SC_seq_page;
  23.    var $nm_location;
  24.    var $nm_data;
  25.    var $nm_cod_barra;
  26.    var $sc_proc_grid
  27.    var $NM_raiz_img
  28.    var $NM_opcao
  29.    var $NM_flag_antigo
  30.    var $nm_campos_cab = array();
  31.    var $NM_cmp_hidden = array();
  32.    var $nmgp_botoes = array();
  33.    var $Cmps_ord_def = array();
  34.    var $nmgp_label_quebras = array();
  35.    var $nmgp_prim_pag_pdf;
  36.    var $Campos_Mens_erro;
  37.    var $Print_All;
  38.    var $NM_field_over;
  39.    var $NM_field_click;
  40.    var $NM_cont_body
  41.    var $NM_emb_tree_no
  42.    var $progress_fp;
  43.    var $progress_tot;
  44.    var $progress_now;
  45.    var $progress_lim_tot;
  46.    var $progress_lim_now;
  47.    var $progress_lim_qtd;
  48.    var $progress_grid;
  49.    var $progress_pdf;
  50.    var $progress_res;
  51.    var $progress_graf;
  52.    var $count_ger;
  53.    var $proprietarios_idproprietario;
  54.    var $proprietarios_nome;
  55.    var $proprietarios_sexo;
  56.    var $proprietarios_cpf;
  57.    var $proprietarios_telefone;
  58.    var $veiculos_idveiculos;
  59.    var $veiculos_anomodelo;
  60.    var $veiculos_placa;
  61.    var $proprietarios_endereco;
  62. //--- 
  63.  function monta_grid($linhas 0)
  64.  {
  65.    global $nm_saida;

  66.    clearstatcache();
  67.    $this->NM_cor_embutida();
  68.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']))
  69.    {
  70.        foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display'] as $NM_cada_field => $NM_cada_opc)
  71.        {
  72.            $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  73.        }
  74.    }
  75.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']))
  76.    {
  77.        foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  78.        {
  79.            $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  80.        }
  81.    }
  82.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']))
  83.    {
  84.        foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  85.        {
  86.            $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  87.        }
  88.    }
  89.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_init'])
  90.    { 
  91.         return; 
  92.    } 
  93.    $this->inicializa();
  94.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['charts_html'] = '';
  95.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  96.    { 
  97.        $this->Lin_impressas 0;
  98.        $this->Lin_final     FALSE;
  99.        $this->grid($linhas);
  100.        $this->nm_fim_grid();
  101.    } 
  102.    else 
  103.    { 
  104.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  105.       {
  106.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  107.        { 
  108.            include_once($this->Ini->path_embutida "grid_new/" $this->Ini->Apl_resumo); 
  109.        } 
  110.        else 
  111.        { 
  112.            include_once($this->Ini->path_aplicacao $this->Ini->Apl_resumo); 
  113.        } 
  114.        $this->Res         = new grid_new_resumo();
  115.        $this->Res->Db     $this->Db;
  116.        $this->Res->Erro   $this->Erro;
  117.        $this->Res->Ini    $this->Ini;
  118.        $this->Res->Lookup $this->Lookup;
  119.       }
  120.        if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_res'])
  121.        {
  122.             if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert'])
  123.             {
  124.             } 
  125.             else
  126.             {
  127.                 $this->cabecalho();
  128.             } 
  129.        } 
  130.             if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert'])
  131.             {
  132.             } 
  133.             else
  134.             {
  135.        $nm_saida->saida("                  <TR>\r\n");
  136.        $nm_saida->saida("                  <TD id='sc_grid_content' style='padding: 0px;' colspan=1>\r\n");
  137.             } 
  138.        $nm_saida->saida("    <table width='100%' cellspacing=0 cellpadding=0>\r\n");
  139.        $nmgrp_apl_opcao= (isset($_SESSION['sc_session']['scriptcase']['embutida_form_pdf']['grid_new'])) ? "pdf" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'];
  140.        if ($nmgrp_apl_opcao != "pdf")
  141.        { 
  142.            $this->nmgp_barra_top();
  143.            $this->nmgp_embbed_placeholder_top();
  144.        } 
  145.        if ($nmgrp_apl_opcao != "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != 'print')
  146.        { 
  147.            if ($this->Ini->grid_search_change_fil)
  148.            { 
  149.                $seq_search 1;
  150.                foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'] as $cmp => $def)
  151.                {
  152.                   $Seq_grid      $seq_search;
  153.                   $Cmp_grid      $cmp;
  154.                   $Def_grid      = array('descr' => $def['descr'], 'hint' => $def['hint']);
  155.                   $Lin_grid_add  $this->grid_search_tag_ini($Cmp_grid$Def_grid$Seq_grid);
  156.                   $NM_func_grid_add "grid_search_" $Cmp_grid;
  157.                   $Lin_grid_add .= $this->$NM_func_grid_add($Seq_grid'S'$def['opc'], $def['val'], $nmgp_tab_label[$Cmp_grid]);
  158.                   $Lin_grid_add .= $this->grid_search_tag_end();
  159.                   $this->Ini->Arr_result['grid_search_add'][] = array ('field' => $cmp'tag' => NM_charset_to_utf8($Lin_grid_add));
  160.                   $seq_search++;
  161.                } 
  162.            } 
  163.            elseif (!$this->Proc_link_res
  164.            { 
  165.                $this->html_grid_search();
  166.            } 
  167.        } 
  168.        unset ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['save_grid']);
  169.        if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_res'] && (!isset($_GET['flash_graf']) || 'chart' != $_GET['flash_graf']))
  170.        {
  171.            $this->grid();
  172.        }
  173.        if ($nmgrp_apl_opcao != "pdf")
  174.        { 
  175.            $this->nmgp_embbed_placeholder_bot();
  176.            $this->nmgp_barra_bot();
  177.        } 
  178.        $nm_saida->saida("   </table>\r\n");
  179.        $nm_saida->saida("  </TD>\r\n");
  180.        $nm_saida->saida(" </TR>\r\n");
  181.        if (strpos(" " $this->Ini->SC_module_export"resume") !== false)
  182.        { 
  183.            $Gera_res true;
  184.        } 
  185.        else 
  186.        { 
  187.            $Gera_res false;
  188.        } 
  189.        if (strpos(" " $this->Ini->SC_module_export"chart") !== false)
  190.        { 
  191.            $Gera_graf true;
  192.        } 
  193.        else 
  194.        { 
  195.            $Gera_graf false;
  196.        } 
  197.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_all'] && empty($this->nm_grid_sem_reg) && ($Gera_res || $Gera_graf) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  198.        { 
  199.            $this->Res->monta_html_ini_pdf();
  200.            $this->Res->monta_resumo();
  201.            $this->Res->monta_html_fim_pdf();
  202.            if ($Gera_graf)
  203.            {
  204.                $this->grafico_pdf();
  205.            }
  206.        } 
  207.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  208.        { 
  209.            if (isset($_GET['flash_graf']) && 'chart' == $_GET['flash_graf'])
  210.            {
  211.                $this->Res->monta_resumo(true);
  212.                require_once($this->Ini->path_aplicacao $this->Ini->Apl_grafico); 
  213.                $this->Graf  = new grid_new_grafico();
  214.                $this->Graf->Db     $this->Db;
  215.                $this->Graf->Erro   $this->Erro;
  216.                $this->Graf->Ini    $this->Ini;
  217.                $this->Graf->Lookup $this->Lookup;
  218.                $this->Graf->monta_grafico();
  219.                exit;
  220.            }
  221.            elseif ($Gera_res || $Gera_graf)
  222.            {
  223.                $this->Res->monta_html_ini_pdf();
  224.                $this->Res->monta_resumo();
  225.                $this->Res->monta_html_fim_pdf();
  226.            }
  227.        } 
  228.        $flag_apaga_pdf_log TRUE;
  229.        if (!$this->Print_All && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  230.        { 
  231.            $flag_apaga_pdf_log FALSE;
  232.        } 
  233.        $this->nm_fim_grid($flag_apaga_pdf_log);
  234.        if (!$this->Print_All && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  235.        { 
  236.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "igual";
  237.        } 
  238.    }
  239.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] == "print")
  240.    {
  241.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_ant'];
  242.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] = "";
  243.    }
  244.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_ant'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'];
  245.  }
  246.  function resume($linhas 0)
  247.  {
  248.     $this->Lin_impressas 0;
  249.     $this->Lin_final     FALSE;
  250.     $this->grid($linhas);
  251.  }
  252. //--- 
  253.  function inicializa()
  254.  {
  255.    global $nm_saida$NM_run_iframe,
  256.    $rec$nmgp_chave$nmgp_opcao$nmgp_ordem$nmgp_chave_det,
  257.    $nmgp_quant_linhas$nmgp_quant_colunas$nmgp_url_saida$nmgp_parms;
  258. //
  259.    if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Ind_lig_mult'])) {
  260.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Ind_lig_mult'] = 0;
  261.    }
  262.    $this->Img_embbed      false;
  263.    $this->nm_data         = new nm_data("en_us");
  264.    $this->pdf_label_group = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_pdf']['label_group'])) ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_pdf']['label_group'] : "N";
  265.    $this->pdf_all_cab     = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_pdf']['all_cab']))     ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_pdf']['all_cab'] : "S";
  266.    $this->pdf_all_label   = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_pdf']['all_label']))   ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_pdf']['all_label'] : "S";
  267.    $this->Grid_body 'id="sc_grid_body"';
  268.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  269.    {
  270.        $this->Grid_body "";
  271.    }
  272.    $this->Css_Cmp = array();
  273.    $NM_css file($this->Ini->root $this->Ini->path_link "grid_new/grid_new_grid_" .strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) . ".css");
  274.    foreach ($NM_css as $cada_css)
  275.    {
  276.        $Pos1 strpos($cada_css"{");
  277.        $Pos2 strpos($cada_css"}");
  278.        $Tag  trim(substr($cada_css1$Pos1 1));
  279.        $Css  substr($cada_css$Pos1 1$Pos2 $Pos1 1);
  280.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word'])
  281.        { 
  282.            $this->Css_Cmp[$Tag] = $Css;
  283.        }
  284.        else
  285.        { 
  286.            $this->Css_Cmp[$Tag] = "";
  287.        }
  288.    }
  289.    if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label']))
  290.    {
  291.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'] = "";
  292.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'] .= "proprietarios_idproprietario?#?" "Id Proprietario" "?@?";
  293.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'] .= "proprietarios_nome?#?" "Nome" "?@?";
  294.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'] .= "proprietarios_sexo?#?" "Sexo" "?@?";
  295.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'] .= "proprietarios_cpf?#?" "Cpf" "?@?";
  296.    }
  297.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_search_add']))
  298.    {
  299.        $nmgp_tab_label $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'];
  300.        if (!empty($nmgp_tab_label))
  301.        {
  302.           $nm_tab_campos explode("?@?"$nmgp_tab_label);
  303.           $nmgp_tab_label = array();
  304.           foreach ($nm_tab_campos as $cada_campo)
  305.           {
  306.               $parte_campo explode("?#?"$cada_campo);
  307.               $nmgp_tab_label[$parte_campo[0]] = $parte_campo[1];
  308.           }
  309.        }
  310.        $Seq_grid      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_search_add']['seq'];
  311.        $Cmp_grid      $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_search_add']['cmp'];
  312.        $Def_grid      = array('descr' => $nmgp_tab_label[$Cmp_grid], 'hint' => $nmgp_tab_label[$Cmp_grid]);
  313.        $Lin_grid_add  $this->grid_search_tag_ini($Cmp_grid$Def_grid$Seq_grid);
  314.        $NM_func_grid_add "grid_search_" $Cmp_grid;
  315.        $Lin_grid_add .= $this->$NM_func_grid_add($Seq_grid'S''', array(), $nmgp_tab_label[$Cmp_grid]);
  316.        $Lin_grid_add .= $this->grid_search_tag_end();
  317.        $this->Arr_result = array();
  318.        $Temp ob_get_clean();
  319.        if ($Temp !== false && trim($Temp) != "")
  320.        {
  321.            $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  322.        }
  323.        $this->Arr_result['grid_add'][] = NM_charset_to_utf8($Lin_grid_add);
  324.        $oJson = new Services_JSON();
  325.        echo $oJson->encode($this->Arr_result);
  326.        unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_search_add']);
  327.        exit;
  328.    }
  329.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dyn_search_aut_comp']))
  330.    {
  331.        $NM_func_aut_comp "lookup_ajax_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dyn_search_aut_comp']['cmp'];
  332.        $parm = ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($_GET['q'])) ? sc_convert_encoding($_GET['q'], $_SESSION['scriptcase']['charset'], "UTF-8") : $_GET['q'];
  333.        $nmgp_def_dados $this->$NM_func_aut_comp($parm);
  334.        ob_end_clean();
  335.        $count_aut_comp 0;
  336.        $resp_aut_comp  = array();
  337.        foreach ($nmgp_def_dados as $Ind => $Lista)
  338.        {
  339.           if (is_array($Lista))
  340.           {
  341.               foreach ($Lista as $Cod => $Valor)
  342.               {
  343.                   if ($_GET['cod_desc'] == "S")
  344.                   {
  345.                       $Valor $Cod " - " $Valor;
  346.                   }
  347.                   $resp_aut_comp[] = array('label' => $Valor 'value' => $Cod);
  348.                   $count_aut_comp++;
  349.               }
  350.           }
  351.           if ($count_aut_comp == $_GET['max_itens'])
  352.           {
  353.               break;
  354.           }
  355.        }
  356.        $oJson = new Services_JSON();
  357.        echo $oJson->encode($resp_aut_comp);
  358.        unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dyn_search_aut_comp']);
  359.        exit;
  360.    }
  361.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  362.    {
  363.        if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Lig_Md5']))
  364.        {
  365.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Lig_Md5'] = array();
  366.        }
  367.    }
  368.    elseif ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != 'print')
  369.    {
  370.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Lig_Md5'] = array();
  371.    }
  372.    $this->force_toolbar false;
  373.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['force_toolbar']))
  374.    { 
  375.        $this->force_toolbar true;
  376.        unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['force_toolbar']);
  377.    } 
  378.        $this->Tem_tab_vert false;
  379.    $this->width_tabula_quebra  "0px";
  380.    $this->width_tabula_display "none";
  381.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['lig_edit']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['lig_edit'] != '')
  382.    {
  383.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['mostra_edit'] = $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['lig_edit'];
  384.    }
  385.    $this->grid_emb_form      false;
  386.    $this->grid_emb_form_full false;
  387.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_form']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_form'])
  388.    {
  389.        if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_form_full']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_form_full'])
  390.        {
  391.           $this->grid_emb_form_full true;
  392.        }
  393.        else
  394.        {
  395.            $this->grid_emb_form true;
  396.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['mostra_edit'] = "N";
  397.        }
  398.    }
  399.    if ($this->Ini->SC_Link_View || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'])
  400.    {
  401.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['mostra_edit'] = "N";
  402.    }
  403.    $this->NM_cont_body   0
  404.    $this->NM_emb_tree_no false
  405.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  406.    { 
  407.        $_SESSION['sc_session'][$this->Ini->sc_page]['NM_arr_tree'] = array();
  408.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ind_tree'] = 0;
  409.    }
  410.    elseif (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['emb_tree_no']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['emb_tree_no'])
  411.    { 
  412.        $this->NM_emb_tree_no true
  413.    }
  414.    $this->aba_iframe false;
  415.    $this->Print_All $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_all'];
  416.    if ($this->Print_All)
  417.    {
  418.        $this->Ini->nm_limite_lin $this->Ini->nm_limite_lin_prt
  419.    }
  420.    if (isset($_SESSION['scriptcase']['sc_aba_iframe']))
  421.    {
  422.        foreach ($_SESSION['scriptcase']['sc_aba_iframe'] as $aba => $apls_aba)
  423.        {
  424.            if (in_array("grid_new"$apls_aba))
  425.            {
  426.                $this->aba_iframe true;
  427.                break;
  428.            }
  429.        }
  430.    }
  431.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['iframe_menu'] && (!isset($_SESSION['scriptcase']['menu_mobile']) || empty($_SESSION['scriptcase']['menu_mobile'])))
  432.    {
  433.        $this->aba_iframe true;
  434.    }
  435.    $this->nmgp_botoes['group_2'] = "on";
  436.    $this->nmgp_botoes['group_1'] = "on";
  437.    $this->nmgp_botoes['group_4'] = "on";
  438.    $this->nmgp_botoes['group_3'] = "on";
  439.    $this->nmgp_botoes['exit'] = "on";
  440.    $this->nmgp_botoes['first'] = "on";
  441.    $this->nmgp_botoes['back'] = "on";
  442.    $this->nmgp_botoes['forward'] = "on";
  443.    $this->nmgp_botoes['last'] = "on";
  444.    $this->nmgp_botoes['filter'] = "on";
  445.    $this->nmgp_botoes['pdf'] = "on";
  446.    $this->nmgp_botoes['xls'] = "on";
  447.    $this->nmgp_botoes['xml'] = "on";
  448.    $this->nmgp_botoes['csv'] = "on";
  449.    $this->nmgp_botoes['rtf'] = "on";
  450.    $this->nmgp_botoes['word'] = "on";
  451.    $this->nmgp_botoes['doc'] = "on";
  452.    $this->nmgp_botoes['export'] = "on";
  453.    $this->nmgp_botoes['print'] = "on";
  454.    $this->nmgp_botoes['html'] = "on";
  455.    $this->nmgp_botoes['goto'] = "on";
  456.    $this->nmgp_botoes['qtline'] = "on";
  457.    $this->nmgp_botoes['navpage'] = "on";
  458.    $this->nmgp_botoes['rows'] = "on";
  459.    $this->nmgp_botoes['summary'] = "on";
  460.    $this->nmgp_botoes['sel_col'] = "on";
  461.    $this->nmgp_botoes['sort_col'] = "on";
  462.    $this->nmgp_botoes['qsearch'] = "on";
  463.    $this->nmgp_botoes['groupby'] = "on";
  464.    $this->nmgp_botoes['gridsave'] = "on";
  465.    $this->Cmps_ord_def['proprietarios_idproprietario'] = " desc";
  466.    $this->Cmps_ord_def["Proprietarios.idProprietario"] = "";
  467.    $this->Cmps_ord_def['proprietarios_nome'] = " asc";
  468.    $this->Cmps_ord_def["Proprietarios.Nome"] = "";
  469.    $this->Cmps_ord_def['proprietarios_sexo'] = " asc";
  470.    $this->Cmps_ord_def["Proprietarios.Sexo"] = "";
  471.    $this->Cmps_ord_def['proprietarios_cpf'] = " desc";
  472.    $this->Cmps_ord_def["Proprietarios.Cpf"] = "";
  473.    $this->Cmps_ord_def['proprietarios_telefone'] = " asc";
  474.    $this->Cmps_ord_def["Proprietarios.Telefone"] = "";
  475.    $this->Cmps_ord_def['proprietarios_endereco'] = " asc";
  476.    $this->Cmps_ord_def["Proprietarios.Endereco"] = "";
  477.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display']))
  478.    {
  479.        foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display'] as $NM_cada_btn => $NM_cada_opc)
  480.        {
  481.            $this->nmgp_botoes[$NM_cada_btn] = $NM_cada_opc;
  482.        }
  483.    }
  484.    $this->Proc_link_res false;
  485.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_resumo']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_resumo'])) 
  486.    { 
  487.        $this->Proc_link_res            true;
  488.        $this->nmgp_botoes['filter']    = 'off';
  489.        $this->nmgp_botoes['groupby']   = 'off';
  490.        $this->nmgp_botoes['dynsearch'] = 'off';
  491.        $this->nmgp_botoes['qsearch']   = 'off';
  492.        $this->nmgp_botoes['gridsave']  = 'off';
  493.    } 
  494.    $this->sc_proc_grid false
  495.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word'] || $this->Ini->sc_export_ajax_img)
  496.    { 
  497.        $this->NM_raiz_img $this->Ini->root
  498.    } 
  499.    else 
  500.    { 
  501.        $this->NM_raiz_img ""
  502.    } 
  503.    $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  504.    $this->nm_where_dinamico "";
  505.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'];  
  506.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']))
  507.    { 
  508.        $Busca_temp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'];
  509.        if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  510.        {
  511.            $Busca_temp NM_conv_charset($Busca_temp$_SESSION['scriptcase']['charset'], "UTF-8");
  512.        }
  513.        $this->proprietarios_idproprietario $Busca_temp['proprietarios_idproprietario']; 
  514.        $tmp_pos strpos($this->proprietarios_idproprietario"##@@");
  515.        if ($tmp_pos !== false && !is_array($this->proprietarios_idproprietario))
  516.        {
  517.            $this->proprietarios_idproprietario substr($this->proprietarios_idproprietario0$tmp_pos);
  518.        }
  519.        $this->proprietarios_nome $Busca_temp['proprietarios_nome']; 
  520.        $tmp_pos strpos($this->proprietarios_nome"##@@");
  521.        if ($tmp_pos !== false && !is_array($this->proprietarios_nome))
  522.        {
  523.            $this->proprietarios_nome substr($this->proprietarios_nome0$tmp_pos);
  524.        }
  525.        $this->proprietarios_sexo $Busca_temp['proprietarios_sexo']; 
  526.        $tmp_pos strpos($this->proprietarios_sexo"##@@");
  527.        if ($tmp_pos !== false && !is_array($this->proprietarios_sexo))
  528.        {
  529.            $this->proprietarios_sexo substr($this->proprietarios_sexo0$tmp_pos);
  530.        }
  531.        $this->proprietarios_cpf $Busca_temp['proprietarios_cpf']; 
  532.        $tmp_pos strpos($this->proprietarios_cpf"##@@");
  533.        if ($tmp_pos !== false && !is_array($this->proprietarios_cpf))
  534.        {
  535.            $this->proprietarios_cpf substr($this->proprietarios_cpf0$tmp_pos);
  536.        }
  537.    } 
  538.    $this->nm_field_dinamico = array();
  539.    $this->nm_order_dinamico = array();
  540.    $this->sc_where_orig   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  541.    $this->sc_where_atual  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  542.    $this->sc_where_filtro $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'];
  543.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "muda_qt_linhas")
  544.    { 
  545.        unset($rec);
  546.    } 
  547.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "muda_rec_linhas")
  548.    { 
  549.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "muda_qt_linhas";
  550.    } 
  551.    $this->sc_where_Max "f" "u" "ll";

  552.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['under_dashboard']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['under_dashboard'] && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['maximized']) {
  553.        $tmpDashboardApp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['dashboard_app'];
  554.        if (isset($_SESSION['scriptcase']['dashboard_toolbar'][$tmpDashboardApp]['grid_new'])) {
  555.            $tmpDashboardButtons $_SESSION['scriptcase']['dashboard_toolbar'][$tmpDashboardApp]['grid_new'];

  556.            $this->nmgp_botoes['first']     = $tmpDashboardButtons['grid_navigate']  ? 'on' 'off';
  557.            $this->nmgp_botoes['back']      = $tmpDashboardButtons['grid_navigate']  ? 'on' 'off';
  558.            $this->nmgp_botoes['last']      = $tmpDashboardButtons['grid_navigate']  ? 'on' 'off';
  559.            $this->nmgp_botoes['forward']   = $tmpDashboardButtons['grid_navigate']  ? 'on' 'off';
  560.            $this->nmgp_botoes['summary']   = $tmpDashboardButtons['grid_summary']   ? 'on' 'off';
  561.            $this->nmgp_botoes['qsearch']   = $tmpDashboardButtons['grid_qsearch']   ? 'on' 'off';
  562.            $this->nmgp_botoes['dynsearch'] = $tmpDashboardButtons['grid_dynsearch'] ? 'on' 'off';
  563.            $this->nmgp_botoes['filter']    = $tmpDashboardButtons['grid_filter']    ? 'on' 'off';
  564.            $this->nmgp_botoes['sel_col']   = $tmpDashboardButtons['grid_sel_col']   ? 'on' 'off';
  565.            $this->nmgp_botoes['sort_col']  = $tmpDashboardButtons['grid_sort_col']  ? 'on' 'off';
  566.            $this->nmgp_botoes['goto']      = $tmpDashboardButtons['grid_goto']      ? 'on' 'off';
  567.            $this->nmgp_botoes['qtline']    = $tmpDashboardButtons['grid_lineqty']   ? 'on' 'off';
  568.            $this->nmgp_botoes['navpage']   = $tmpDashboardButtons['grid_navpage']   ? 'on' 'off';
  569.            $this->nmgp_botoes['pdf']       = $tmpDashboardButtons['grid_pdf']       ? 'on' 'off';
  570.            $this->nmgp_botoes['xls']       = $tmpDashboardButtons['grid_xls']       ? 'on' 'off';
  571.            $this->nmgp_botoes['xml']       = $tmpDashboardButtons['grid_xml']       ? 'on' 'off';
  572.            $this->nmgp_botoes['csv']       = $tmpDashboardButtons['grid_csv']       ? 'on' 'off';
  573.            $this->nmgp_botoes['rtf']       = $tmpDashboardButtons['grid_rtf']       ? 'on' 'off';
  574.            $this->nmgp_botoes['word']      = $tmpDashboardButtons['grid_word']      ? 'on' 'off';
  575.            $this->nmgp_botoes['doc']       = $tmpDashboardButtons['grid_doc']       ? 'on' 'off';
  576.            $this->nmgp_botoes['print']     = $tmpDashboardButtons['grid_print']     ? 'on' 'off';
  577.            $this->nmgp_botoes['new']       = $tmpDashboardButtons['grid_new']       ? 'on' 'off';
  578.            $this->nmgp_botoes['img']       = $tmpDashboardButtons['img']            ? 'on' 'off';
  579.            $this->nmgp_botoes['html']      = $tmpDashboardButtons['html']           ? 'on' 'off';
  580.        }
  581.    }

  582.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  583.    {
  584.        $nmgp_ordem ""
  585.        $rec "ini"
  586.    } 
  587. //
  588.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  589.    { 
  590.        include_once($this->Ini->path_embutida "grid_new/grid_new_total.class.php"); 
  591.    } 
  592.    else 
  593.    { 
  594.        include_once($this->Ini->path_aplicacao "grid_new_total.class.php"); 
  595.    } 
  596.    $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  597.    $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  598.    $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  599.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  600.    { 
  601.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_pdf'] != "pdf")  
  602.        { 
  603.            $_SESSION['scriptcase']['contr_link_emb'] = $this->nm_location;
  604.        } 
  605.        else 
  606.        { 
  607.            $_SESSION['scriptcase']['contr_link_emb'] = "pdf";
  608.        } 
  609.    } 
  610.    else 
  611.    { 
  612.        $this->nm_location $_SESSION['scriptcase']['contr_link_emb'];
  613.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_pdf'] = $_SESSION['scriptcase']['contr_link_emb'];
  614.    } 
  615.    $this->Tot         = new grid_new_total($this->Ini->sc_page);
  616.    $this->Tot->Db     $this->Db;
  617.    $this->Tot->Erro   $this->Erro;
  618.    $this->Tot->Ini    $this->Ini;
  619.    $this->Tot->Lookup $this->Lookup;
  620.    if (empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid']))
  621.    { 
  622.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] = 10;
  623.    }   
  624.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['rows']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['rows']))
  625.    {
  626.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] = $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['rows'];  
  627.        unset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['rows']);
  628.    }
  629.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['cols']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['cols']))
  630.    {
  631.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_col_grid'] = $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['cols'];  
  632.        unset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['cols']);
  633.    }
  634.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['rows']))
  635.    {
  636.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['rows'];  
  637.    }
  638.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['cols']))
  639.    {
  640.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_col_grid'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['cols'];  
  641.    }
  642.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "muda_qt_linhas"
  643.    { 
  644.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']  = "igual" ;  
  645.        if (!empty($nmgp_quant_linhas) && !is_array($nmgp_quant_linhas)) 
  646.        { 
  647.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] = $nmgp_quant_linhas ;  
  648.        } 
  649.    }   
  650.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid']; 
  651.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total"
  652.    {
  653.        if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_select']))  
  654.        { 
  655.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_select'] = array(); 
  656.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_select_orig'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_select']; 
  657.        } 
  658.    }
  659.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total"
  660.    {
  661.        if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_quebra']))  
  662.        { 
  663.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_quebra'] = array(); 
  664.        } 
  665.    }
  666.    if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_grid']))  
  667.    { 
  668.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_grid'] = "" 
  669.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_ant']  = ""
  670.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_desc'] = ""
  671.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_cmp']  = ""
  672.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_label'] = "";  
  673.    }   
  674.    if (!empty($nmgp_ordem))  
  675.    { 
  676.        $nmgp_ordem str_replace('\"''"'$nmgp_ordem); 
  677.        if (!isset($this->Cmps_ord_def[$nmgp_ordem])) 
  678.        { 
  679.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "igual" ;  
  680.        }
  681.        else
  682.        { 
  683.            $Ordem_tem_quebra false;
  684.            foreach($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_quebra'] as $campo => $resto
  685.            {
  686.                foreach($resto as $sqldef => $ordem
  687.                {
  688.                    if ($sqldef == $nmgp_ordem
  689.                    { 
  690.                        $Ordem_tem_quebra true;
  691.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "inicio" ;  
  692.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_grid'] = ""
  693.                        $ordem = ($ordem == "asc") ? "desc" "asc";
  694.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_quebra'][$campo][$nmgp_ordem] = $ordem;
  695.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_cmp'] = $nmgp_ordem;
  696.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_label'] = trim($ordem);
  697.                    }   
  698.                }   
  699.            }   
  700.            if (!$Ordem_tem_quebra)
  701.            {
  702.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_grid'] = $nmgp_ordem  
  703.            }
  704.        }
  705.    }   
  706.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "ordem")  
  707.    { 
  708.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "inicio" ;  
  709.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_ant'] == $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_grid'])  
  710.        { 
  711.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_desc'] != " desc")  
  712.            { 
  713.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_desc'] = " desc" 
  714.            } 
  715.            else   
  716.            { 
  717.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_desc'] = " asc" ;  
  718.            } 
  719.        } 
  720.        else 
  721.        { 
  722.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_desc'] = $this->Cmps_ord_def[$nmgp_ordem];  
  723.        } 
  724.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_label'] = trim($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_desc']);  
  725.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_ant'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_grid'];  
  726.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_cmp'] = $nmgp_ordem;  
  727.    }  
  728.    if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio']))  
  729.    { 
  730.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] = ;  
  731.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final']  = ;  
  732.    }   
  733.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_edit'])  
  734.    { 
  735.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_edit'] = false;  
  736.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "inicio"
  737.        { 
  738.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "edit" 
  739.        } 
  740.    }   
  741.    if (!empty($nmgp_parms) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf")   
  742.    { 
  743.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "igual";
  744.        $rec "ini";
  745.    }
  746.    if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig']) || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['prim_cons'] || !empty($nmgp_parms))  
  747.    { 
  748.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['prim_cons'] = false;  
  749.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'] = "";  
  750.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']        = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];  
  751.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant']    = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];  
  752.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq']         = ""
  753.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = "";
  754.    }   
  755.    if  (!empty($this->nm_where_dinamico)) 
  756.    {   
  757.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] .= $this->nm_where_dinamico;
  758.    }   
  759.    $this->sc_where_orig   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  760.    $this->sc_where_atual  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  761.    $this->sc_where_filtro $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'];
  762.    $this->sc_where_atual_f = (!empty($this->sc_where_atual)) ? "(" trim(substr($this->sc_where_atual6)) . ")" "";
  763.    $this->sc_where_atual_f str_replace("%""@percent@"$this->sc_where_atual_f);
  764.    $this->sc_where_atual_f "NM_where_filter*scin" str_replace("'""@aspass@"$this->sc_where_atual_f) . "*scout";
  765. //
  766. //--------- 
  767. //
  768.    $nmgp_opc_orig $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']; 
  769.    if (isset($rec)) 
  770.    { 
  771.        if ($rec == "ini"
  772.        { 
  773.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "inicio" 
  774.        } 
  775.        elseif ($rec == "fim"
  776.        { 
  777.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "final" 
  778.        } 
  779.        else 
  780.        { 
  781.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "avanca" 
  782.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final'] = $rec
  783.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final'] > 0
  784.            { 
  785.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final']-- ; 
  786.            } 
  787.        } 
  788.    } 
  789.    $this->NM_opcao $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']; 
  790.    if ($this->NM_opcao == "print"
  791.    { 
  792.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] = "print" 
  793.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']       = "igual" 
  794.        if ($this->Ini->sc_export_ajax
  795.        { 
  796.            $this->Img_embbed true;
  797.        } 
  798.    } 
  799. // 
  800.    $this->count_ger 0;
  801.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1])) 
  802.    { 
  803.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_total'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1] ;  
  804.    }
  805.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "final" || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid'] == "all"
  806.    { 
  807.        $Gb_geral "quebra_geral_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'];
  808.        $this->Tot->$Gb_geral();
  809.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_total'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1] ;  
  810.        $this->count_ger $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1];
  811.    } 
  812.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_dinamic']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_dinamic'] != $this->nm_where_dinamico)  
  813.    { 
  814.        unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral']);
  815.    } 
  816.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_dinamic'] = $this->nm_where_dinamico;  
  817.    if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral']) || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] != $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'] || $nmgp_opc_orig == "edit"
  818.    { 
  819.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral'] = "NAO";
  820.        unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_total']);
  821.        $Gb_geral "quebra_geral_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'];
  822.        $this->Tot->$Gb_geral();
  823.        if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_array_resumo']))  
  824.        { 
  825.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_array_resumo'] = "NAO";
  826.        } 
  827.    } 
  828.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_total'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1] ;  
  829.    $this->count_ger $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1];
  830.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid'] == "all"
  831.    { 
  832.         $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid'] = $this->count_ger;
  833.         $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']       = "inicio";
  834.    } 
  835.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "inicio" || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pesq"
  836.    { 
  837.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] = 
  838.    } 
  839.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "final"
  840.    { 
  841.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_total'] - $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid']; 
  842.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] < 0
  843.        { 
  844.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] = 
  845.        } 
  846.    } 
  847.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "retorna"
  848.    { 
  849.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] - $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid']; 
  850.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] < 0
  851.        { 
  852.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] = 
  853.        } 
  854.    } 
  855.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "avanca" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_total'] >  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final']) 
  856.    { 
  857.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final']; 
  858.    } 
  859.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'], 07) != "detalhe" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf"
  860.    { 
  861.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "igual"
  862.    } 
  863.    $this->Rec_ini $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] - $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid']; 
  864.    if ($this->Rec_ini 0
  865.    { 
  866.        $this->Rec_ini 0
  867.    } 
  868.    $this->Rec_fim $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] + $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid'] + 1
  869.    if ($this->Rec_fim $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_total']) 
  870.    { 
  871.        $this->Rec_fim $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_total']; 
  872.    } 
  873.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] > 0
  874.    { 
  875.        $this->Rec_ini++ ; 
  876.    } 
  877.    $this->nmgp_reg_start $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio']; 
  878.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] > 0
  879.    { 
  880.        $this->nmgp_reg_start--; 
  881.    } 
  882.    $this->nm_grid_ini $this->nmgp_reg_start 1
  883.    if ($this->nmgp_reg_start != 0
  884.    { 
  885.        $this->nm_grid_ini++;
  886.    }  
  887. //----- 
  888.    if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
  889.    { 
  890.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  891.    } 
  892.    elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  893.    { 
  894.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  895.    } 
  896.    elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  897.    { 
  898.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  899.    } 
  900.    elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  901.    { 
  902.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  903.    } 
  904.    elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
  905.    { 
  906.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  907.    } 
  908.    else 
  909.    { 
  910.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  911.    } 
  912.    $nmgp_select .= " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']; 
  913.    $nmgp_order_by ""
  914.    $campos_order_select "";
  915.    foreach($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_select'] as $campo => $ordem
  916.    {
  917.         if ($campo != $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_grid']) 
  918.         {
  919.            if (!empty($campos_order_select)) 
  920.            {
  921.                $campos_order_select .= ", ";
  922.            }
  923.            $campos_order_select .= $campo " " $ordem;
  924.         }
  925.    }
  926.    $campos_order "";
  927.    foreach($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_quebra'] as $campo => $resto
  928.    {
  929.        foreach($resto as $sqldef => $ordem
  930.        {
  931.            $format       $this->Ini->Get_Gb_date_format($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'], $campo);
  932.            $campos_order $this->Ini->Get_date_order_groupby($sqldef$ordem$format$campos_order);
  933.        }
  934.    }
  935.    if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_grid'])) 
  936.    { 
  937.        if (!empty($campos_order)) 
  938.        { 
  939.            $campos_order .= ", ";
  940.        } 
  941.        $nmgp_order_by " order by " $campos_order $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_grid'] . $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_desc']; 
  942.    } 
  943.    elseif (!empty($campos_order_select)) 
  944.    { 
  945.        if (!empty($campos_order)) 
  946.        { 
  947.            $campos_order .= ", ";
  948.        } 
  949.        $nmgp_order_by " order by " $campos_order $campos_order_select
  950.    } 
  951.    elseif (!empty($campos_order)) 
  952.    { 
  953.        $nmgp_order_by " order by " $campos_order
  954.    } 
  955.    if (substr(trim($nmgp_order_by), -1) == ",")
  956.    {
  957.        $nmgp_order_by " " substr(trim($nmgp_order_by), 0, -1);
  958.    }
  959.    if (trim($nmgp_order_by) == "order by")
  960.    {
  961.        $nmgp_order_by "";
  962.    }
  963.    $nmgp_select .= $nmgp_order_by
  964.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['order_grid'] = $nmgp_order_by;
  965.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" || $this->Ini->Apl_paginacao == "FULL")
  966.    {
  967.        $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select
  968.        $this->rs_grid $this->Db->Execute($nmgp_select) ; 
  969.    }
  970.    else  
  971.    {
  972.        $_SESSION['scriptcase']['sc_sql_ult_comando'] = "SelectLimit($nmgp_select, " . ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid'] + 2) . ", $this->nmgp_reg_start)" 
  973.        $this->rs_grid $this->Db->SelectLimit($nmgp_select$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid'] + 2$this->nmgp_reg_start) ; 
  974.    }  
  975.    $this->sc_where_Min "s" "c_c" "tl" "_aj" "ax";
  976.    if ($this->rs_grid === false && !$this->rs_grid->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1
  977.    { 
  978.        $this->Erro->mensagem(__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  979.        exit ; 
  980.    }  
  981.    if ($this->rs_grid->EOF || ($this->rs_grid === false && $GLOBALS["NM_ERRO_IBASE"] == 1)) 
  982.    { 
  983.        $this->force_toolbar true;
  984.        $this->nm_grid_sem_reg $this->Ini->Nm_lang['lang_errm_empt']; 
  985.    }  
  986.    else 
  987.    { 
  988.        $this->proprietarios_idproprietario $this->rs_grid->fields[0] ;  
  989.        $this->proprietarios_idproprietario = (string)$this->proprietarios_idproprietario;
  990.        $this->proprietarios_nome $this->rs_grid->fields[1] ;  
  991.        $this->proprietarios_sexo $this->rs_grid->fields[2] ;  
  992.        $this->proprietarios_cpf $this->rs_grid->fields[3] ;  
  993.        $this->proprietarios_cpf = (string)$this->proprietarios_cpf;
  994.        $this->proprietarios_telefone $this->rs_grid->fields[4] ;  
  995.        $this->veiculos_idveiculos $this->rs_grid->fields[5] ;  
  996.        $this->veiculos_idveiculos = (string)$this->veiculos_idveiculos;
  997.        $this->veiculos_anomodelo $this->rs_grid->fields[6] ;  
  998.        $this->veiculos_placa $this->rs_grid->fields[7] ;  
  999.        $this->proprietarios_endereco $this->rs_grid->fields[8] ;  
  1000.        $this->SC_seq_register $this->nmgp_reg_start 
  1001.        $this->SC_seq_page 0;
  1002.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final'] = $this->nmgp_reg_start 
  1003.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['inicio'] != && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf"
  1004.        { 
  1005.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final']++ ; 
  1006.            $this->SC_seq_register $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final']; 
  1007.            $this->rs_grid->MoveNext(); 
  1008.            $this->proprietarios_idproprietario $this->rs_grid->fields[0] ;  
  1009.            $this->proprietarios_nome $this->rs_grid->fields[1] ;  
  1010.            $this->proprietarios_sexo $this->rs_grid->fields[2] ;  
  1011.            $this->proprietarios_cpf $this->rs_grid->fields[3] ;  
  1012.            $this->proprietarios_telefone $this->rs_grid->fields[4] ;  
  1013.            $this->veiculos_idveiculos $this->rs_grid->fields[5] ;  
  1014.            $this->veiculos_anomodelo $this->rs_grid->fields[6] ;  
  1015.            $this->veiculos_placa $this->rs_grid->fields[7] ;  
  1016.            $this->proprietarios_endereco $this->rs_grid->fields[8] ;  
  1017.        } 
  1018.    } 
  1019.    $this->nmgp_reg_inicial $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final'] + 1;
  1020.    $this->nmgp_reg_final   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final'] + $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid'];
  1021.    $this->nmgp_reg_final   = ($this->nmgp_reg_final $this->count_ger) ? $this->count_ger $this->nmgp_reg_final;
  1022. // 
  1023.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1024.    { 
  1025.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word'] && !$this->Ini->sc_export_ajax)
  1026.        {
  1027.            require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  1028.            $this->pb = new scProgressBar();
  1029.            $this->pb->setRoot($this->Ini->root);
  1030.            $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  1031.            $this->pb->setProgressbarMd5($_GET['pbmd5']);
  1032.            $this->pb->initialize();
  1033.            $this->pb->setReturnUrl("./");
  1034.            $this->pb->setReturnOption($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_return']);
  1035.            $this->pb->setTotalSteps($this->count_ger);
  1036.        }
  1037.        if ($this->Ini->Proc_print && $this->Ini->Export_html_zip  && !$this->Ini->sc_export_ajax)
  1038.        {
  1039.            require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  1040.            $this->pb = new scProgressBar();
  1041.            $this->pb->setRoot($this->Ini->root);
  1042.            $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  1043.            $this->pb->setProgressbarMd5($_GET['pbmd5']);
  1044.            $this->pb->initialize();
  1045.            $this->pb->setReturnUrl("./");
  1046.            $this->pb->setReturnOption($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_return']);
  1047.            $this->pb->setTotalSteps($this->count_ger);
  1048.        }
  1049.        if (!$this->Ini->sc_export_ajax && !$this->Print_All && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_res'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_pdf'] != "pdf")
  1050.        {
  1051.            //---------- Gauge ----------
  1052. ?>
  1053. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  1054.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  1055. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  1056. <HEAD>
  1057.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: PDF</TITLE>
  1058.  <META http-equiv="Content-Type" content="text/html; charset=utf-8" />
  1059. <?php
  1060.            if ($_SESSION['scriptcase']['proc_mobile'])
  1061.            {
  1062. ?>
  1063.                     <meta name="viewport" content="minimal-ui, width=300, initial-scale=1, maximum-scale=1, user-scalable=no">
  1064.                     <meta name="mobile-web-app-capable" content="yes">
  1065.                     <meta name="apple-mobile-web-app-capable" content="yes">
  1066.                     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  1067.                     <link rel="apple-touch-icon"   sizes="57x57" href="">
  1068.                     <link rel="apple-touch-icon"   sizes="60x60" href="">
  1069.                     <link rel="apple-touch-icon"   sizes="72x72" href="">
  1070.                     <link rel="apple-touch-icon"   sizes="76x76" href="">
  1071.                     <link rel="apple-touch-icon" sizes="114x114" href="">
  1072.                     <link rel="apple-touch-icon" sizes="120x120" href="">
  1073.                     <link rel="apple-touch-icon" sizes="144x144" href="">
  1074.                     <link rel="apple-touch-icon" sizes="152x152" href="">
  1075.                     <link rel="apple-touch-icon" sizes="180x180" href="">
  1076.                     <link rel="icon" type="image/png" sizes="192x192" href="">
  1077.                     <link rel="icon" type="image/png"   sizes="32x32" href="">
  1078.                     <link rel="icon" type="image/png"   sizes="96x96" href="">
  1079.                     <link rel="icon" type="image/png"   sizes="16x16" href="">
  1080.                     <meta name="msapplication-TileColor" content="#3C4858">
  1081.                     <meta name="msapplication-TileImage" content="">
  1082.                     <meta name="theme-color" content="#3C4858">
  1083.                     <meta name="apple-mobile-web-app-status-bar-style" content="#3C4858">
  1084.                     <link rel="shortcut icon" href=""><?php
  1085.            }
  1086. ?>
  1087.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
  1088.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?>" GMT">
  1089.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
  1090.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0">
  1091.  <META http-equiv="Pragma" content="no-cache">
  1092.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  1093.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_grid.css" /> 
  1094.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_grid<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  1095.  <?php 
  1096.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts)) 
  1097.  { 
  1098.  ?> 
  1099.  <link href="<?php echo $this->Ini->str_google_fonts ?>" rel="stylesheet" /> 
  1100.  <?php 
  1101.  } 
  1102.  ?> 
  1103.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  1104.  <SCRIPT LANGUAGE="Javascript" SRC="<?php echo $this->Ini->path_js?>/nm_gauge.js"></SCRIPT>
  1105. </HEAD>
  1106. <BODY scrolling="no">
  1107. <table class="scGridTabela" style="padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;"><tr class="scGridFieldOddVert"><td>
  1108. <?php echo $this->Ini->Nm_lang['lang_pdff_gnrt']; ?>...<br>
  1109. <?php
  1110.            $this->progress_grid    $this->rs_grid->RecordCount();
  1111.            $this->progress_pdf     0;
  1112.            $this->progress_res     = isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_charts']) ? sizeof($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_charts']) : 0;
  1113.            $this->progress_graf    0;
  1114.            $this->progress_tot     0;
  1115.            $this->progress_now     0;
  1116.            $this->progress_lim_tot 0;
  1117.            $this->progress_lim_now 0;
  1118.            if (-$this->progress_grid)
  1119.            {
  1120.                $this->progress_lim_qtd = (250 $this->progress_grid) ? 250 $this->progress_grid;
  1121.                $this->progress_lim_tot floor($this->progress_grid $this->progress_lim_qtd);
  1122.                $this->progress_pdf     floor($this->progress_grid 0.25) + 1;
  1123.                $this->progress_tot     $this->progress_grid $this->progress_pdf $this->progress_res $this->progress_graf;
  1124.                $str_pbfile             = isset($_GET['pbfile']) ? urldecode($_GET['pbfile']) : $this->Ini->root $this->Ini->path_imag_temp '/sc_pb_' session_id() . '.tmp';
  1125.                $this->progress_fp      fopen($str_pbfile'w');
  1126.                fwrite($this->progress_fp"PDF\n");
  1127.                fwrite($this->progress_fp$this->Ini->path_js   "\n");
  1128.                fwrite($this->progress_fp$this->Ini->path_prod "/img/\n");
  1129.                fwrite($this->progress_fp$this->progress_tot   "\n");
  1130.                $lang_protect $this->Ini->Nm_lang['lang_pdff_strt'];
  1131.                if (!NM_is_utf8($lang_protect))
  1132.                {
  1133.                    $lang_protect sc_convert_encoding($lang_protect"UTF-8"$_SESSION['scriptcase']['charset']);
  1134.                }
  1135.                fwrite($this->progress_fp"1_#NM#_" $lang_protect "...\n");
  1136.                flush();
  1137.            }
  1138.        }
  1139.        $nm_fundo_pagina ""
  1140.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word'])
  1141.        {
  1142.            $nm_saida->saida("  <html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:w=\"urn:schemas-microsoft-com:office:word\" xmlns:m=\"http://schemas.microsoft.com/office/2004/12/omml\" xmlns=\"http://www.w3.org/TR/REC-html40\">\r\n");
  1143.        }
  1144.        $nm_saida->saida("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n");
  1145.        $nm_saida->saida("            \"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd\">\r\n");
  1146.        $nm_saida->saida("  <HTML" $_SESSION['scriptcase']['reg_conf']['html_dir'] . ">\r\n");
  1147.        $nm_saida->saida("  <HEAD>\r\n");
  1148.        $nm_saida->saida("   <TITLE>" $this->Ini->Nm_lang['lang_othr_grid_title'] . " </TITLE>\r\n");
  1149.        $nm_saida->saida("   <META http-equiv=\"Content-Type\" content=\"text/html; charset=" $_SESSION['scriptcase']['charset_html'] . "\" />\r\n");
  1150.        if ($_SESSION['scriptcase']['proc_mobile'])
  1151.        {
  1152. $nm_saida->saida("                        <meta name=\"viewport\" content=\"minimal-ui, width=300, initial-scale=1, maximum-scale=1, user-scalable=no\">\r\n");
  1153. $nm_saida->saida("                        <meta name=\"mobile-web-app-capable\" content=\"yes\">\r\n");
  1154. $nm_saida->saida("                        <meta name=\"apple-mobile-web-app-capable\" content=\"yes\">\r\n");
  1155. $nm_saida->saida("                        <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n");
  1156. $nm_saida->saida("                        <link rel=\"apple-touch-icon\" sizes=\"57x57\" href=\"\">\r\n");
  1157. $nm_saida->saida("                        <link rel=\"apple-touch-icon\" sizes=\"60x60\" href=\"\">\r\n");
  1158. $nm_saida->saida("                        <link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"\">\r\n");
  1159. $nm_saida->saida("                        <link rel=\"apple-touch-icon\" sizes=\"76x76\" href=\"\">\r\n");
  1160. $nm_saida->saida("                        <link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"\">\r\n");
  1161. $nm_saida->saida("                        <link rel=\"apple-touch-icon\" sizes=\"120x120\" href=\"\">\r\n");
  1162. $nm_saida->saida("                        <link rel=\"apple-touch-icon\" sizes=\"144x144\" href=\"\">\r\n");
  1163. $nm_saida->saida("                        <link rel=\"apple-touch-icon\" sizes=\"152x152\" href=\"\">\r\n");
  1164. $nm_saida->saida("                        <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"\">\r\n");
  1165. $nm_saida->saida("                        <link rel=\"icon\" type=\"image/png\" sizes=\"192x192\"  href=\"\">\r\n");
  1166. $nm_saida->saida("                        <link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"\">\r\n");
  1167. $nm_saida->saida("                        <link rel=\"icon\" type=\"image/png\" sizes=\"96x96\" href=\"\">\r\n");
  1168. $nm_saida->saida("                        <link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"\">\r\n");
  1169. $nm_saida->saida("                        <meta name=\"msapplication-TileColor\" content=\"#3C4858\" >\r\n");
  1170. $nm_saida->saida("                        <meta name=\"msapplication-TileImage\" content=\"\">\r\n");
  1171. $nm_saida->saida("                        <meta name=\"theme-color\" content=\"#3C4858\">\r\n");
  1172. $nm_saida->saida("                        <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"#3C4858\">\r\n");
  1173. $nm_saida->saida("                        <link rel=\"shortcut icon\" href=\"\">\r\n");
  1174.        }
  1175.        if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word'])
  1176.        {
  1177.            $nm_saida->saida("   <META http-equiv=\"Expires\" content=\"Fri, Jan 01 1900 00:00:00 GMT\"/>\r\n");
  1178.            $nm_saida->saida("   <META http-equiv=\"Last-Modified\" content=\"" gmdate("D, d M Y H:i:s") . " GMT\"/>\r\n");
  1179.            $nm_saida->saida("   <META http-equiv=\"Cache-Control\" content=\"no-store, no-cache, must-revalidate\"/>\r\n");
  1180.            $nm_saida->saida("   <META http-equiv=\"Cache-Control\" content=\"post-check=0, pre-check=0\"/>\r\n");
  1181.            $nm_saida->saida("   <META http-equiv=\"Pragma\" content=\"no-cache\"/>\r\n");
  1182.        }
  1183.        $nm_saida->saida("   <link rel=\"shortcut icon\" href=\"../_lib/img/scriptcase__NM__ico__NM__favicon.ico\">\r\n");
  1184.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1185.        { 
  1186.            $css_body "";
  1187.        } 
  1188.        else 
  1189.        { 
  1190.            $css_body "margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0px;";
  1191.        } 
  1192.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'] && !$this->Ini->sc_export_ajax)
  1193.        { 
  1194.            $nm_saida->saida("   <form name=\"form_ajax_redir_1\" method=\"post\" style=\"display: none\">\r\n");
  1195.            $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_parms\">\r\n");
  1196.            $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_outra_jan\">\r\n");
  1197.            $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" session_id() . "\">\r\n");
  1198.            $nm_saida->saida("   </form>\r\n");
  1199.            $nm_saida->saida("   <form name=\"form_ajax_redir_2\" method=\"post\" style=\"display: none\"> \r\n");
  1200.            $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_parms\">\r\n");
  1201.            $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_url_saida\">\r\n");
  1202.            $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\">\r\n");
  1203.            $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" session_id() . "\">\r\n");
  1204.            $nm_saida->saida("   </form>\r\n");
  1205.            $confirmButtonClass '';
  1206.            $cancelButtonClass  '';
  1207.            $confirmButtonText  $this->Ini->Nm_lang['lang_btns_cfrm'];
  1208.            $cancelButtonText   $this->Ini->Nm_lang['lang_btns_cncl'];
  1209.            $confirmButtonFA    '';
  1210.            $cancelButtonFA     '';
  1211.            $confirmButtonFAPos '';
  1212.            $cancelButtonFAPos  '';
  1213.            if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['style']) && '' != $this->arr_buttons['bsweetalert_ok']['style']) {
  1214.                $confirmButtonClass 'scButton_' $this->arr_buttons['bsweetalert_ok']['style'];
  1215.            }
  1216.            if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['style']) && '' != $this->arr_buttons['bsweetalert_cancel']['style']) {
  1217.                $cancelButtonClass 'scButton_' $this->arr_buttons['bsweetalert_cancel']['style'];
  1218.            }
  1219.            if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['value']) && '' != $this->arr_buttons['bsweetalert_ok']['value']) {
  1220.                $confirmButtonText $this->arr_buttons['bsweetalert_ok']['value'];
  1221.            }
  1222.            if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['value']) && '' != $this->arr_buttons['bsweetalert_cancel']['value']) {
  1223.                $cancelButtonText $this->arr_buttons['bsweetalert_cancel']['value'];
  1224.            }
  1225.            if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['fontawesomeicon']) && '' != $this->arr_buttons['bsweetalert_ok']['fontawesomeicon']) {
  1226.                $confirmButtonFA $this->arr_buttons['bsweetalert_ok']['fontawesomeicon'];
  1227.            }
  1228.            if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['fontawesomeicon']) && '' != $this->arr_buttons['bsweetalert_cancel']['fontawesomeicon']) {
  1229.                $cancelButtonFA $this->arr_buttons['bsweetalert_cancel']['fontawesomeicon'];
  1230.            }
  1231.            if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['display_position']) && 'img_right' != $this->arr_buttons['bsweetalert_ok']['display_position']) {
  1232.                $confirmButtonFAPos 'text_right';
  1233.            }
  1234.            if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['display_position']) && 'img_right' != $this->arr_buttons['bsweetalert_cancel']['display_position']) {
  1235.                $cancelButtonFAPos 'text_right';
  1236.            }
  1237.            $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  1238.            $nm_saida->saida("     var scSweetAlertConfirmButton = \"" $confirmButtonClass "\";\r\n");
  1239.            $nm_saida->saida("     var scSweetAlertCancelButton = \"" $cancelButtonClass "\";\r\n");
  1240.            $nm_saida->saida("     var scSweetAlertConfirmButtonText = \"" $confirmButtonText "\";\r\n");
  1241.            $nm_saida->saida("     var scSweetAlertCancelButtonText = \"" $cancelButtonText "\";\r\n");
  1242.            $nm_saida->saida("     var scSweetAlertConfirmButtonFA = \"" $confirmButtonFA "\";\r\n");
  1243.            $nm_saida->saida("     var scSweetAlertCancelButtonFA = \"" $cancelButtonFA "\";\r\n");
  1244.            $nm_saida->saida("     var scSweetAlertConfirmButtonFAPos = \"" $confirmButtonFAPos "\";\r\n");
  1245.            $nm_saida->saida("     var scSweetAlertCancelButtonFAPos = \"" $cancelButtonFAPos "\";\r\n");
  1246.            $nm_saida->saida("   </script>\r\n");
  1247.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"grid_new_jquery.js\"></script>\r\n");
  1248.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"grid_new_ajax.js\"></script>\r\n");
  1249.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"grid_new_message.js\"></script>\r\n");
  1250.            $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  1251.            $nm_saida->saida("     var sc_ajaxBg = '" $this->Ini->Color_bg_ajax "';\r\n");
  1252.            $nm_saida->saida("     var sc_ajaxBordC = '" $this->Ini->Border_c_ajax "';\r\n");
  1253.            $nm_saida->saida("     var sc_ajaxBordS = '" $this->Ini->Border_s_ajax "';\r\n");
  1254.            $nm_saida->saida("     var sc_ajaxBordW = '" $this->Ini->Border_w_ajax "';\r\n");
  1255.            $nm_saida->saida("   </script>\r\n");
  1256.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/jquery/js/jquery.js\"></script>\r\n");
  1257.            $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" $this->Ini->str_schema_all "_sweetalert.css\" />\r\n");
  1258.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/sweetalert/sweetalert2.all.min.js\"></script>\r\n");
  1259.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/sweetalert/polyfill.min.js\"></script>\r\n");
  1260.            $nm_saida->saida("<script type=\"text/javascript\" src=\"../_lib/lib/js/frameControl.js\"></script>\r\n");
  1261.            $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  1262.            $nm_saida->saida("      if (!window.Promise)\r\n");
  1263.            $nm_saida->saida("      {\r\n");
  1264.            $nm_saida->saida("          var head = document.getElementsByTagName('head')[0];\r\n");
  1265.            $nm_saida->saida("          var js = document.createElement(\"script\");\r\n");
  1266.            $nm_saida->saida("          js.src = \"../_lib/lib/js/bluebird.min.js\";\r\n");
  1267.            $nm_saida->saida("          head.appendChild(js);\r\n");
  1268.            $nm_saida->saida("      }\r\n");
  1269.            $nm_saida->saida("      $(\"#TB_iframeContent\").ready(function(){\r\n");
  1270.            $nm_saida->saida("         jQuery(document).bind('keydown.thickbox', function(e) {\r\n");
  1271.            $nm_saida->saida("            var keyPressed = e.charCode || e.keyCode || e.which;\r\n");
  1272.            $nm_saida->saida("            if (keyPressed == 27) { \r\n");
  1273.            $nm_saida->saida("                tb_remove();\r\n");
  1274.            $nm_saida->saida("            }\r\n");
  1275.            $nm_saida->saida("         })\r\n");
  1276.            $nm_saida->saida("      })\r\n");
  1277.            $nm_saida->saida("   </script>\r\n");
  1278.            $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  1279.            $nm_saida->saida("     var applicationKeys = '';\r\n");
  1280.            $nm_saida->saida("     applicationKeys += 'ctrl+shift+right';\r\n");
  1281.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1282.            $nm_saida->saida("     applicationKeys += 'ctrl+shift+left';\r\n");
  1283.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1284.            $nm_saida->saida("     applicationKeys += 'ctrl+right';\r\n");
  1285.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1286.            $nm_saida->saida("     applicationKeys += 'ctrl+left';\r\n");
  1287.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1288.            $nm_saida->saida("     applicationKeys += 'alt+q';\r\n");
  1289.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1290.            $nm_saida->saida("     applicationKeys += 'ctrl+f';\r\n");
  1291.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1292.            $nm_saida->saida("     applicationKeys += 'ctrl+s';\r\n");
  1293.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1294.            $nm_saida->saida("     applicationKeys += 'alt+enter';\r\n");
  1295.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1296.            $nm_saida->saida("     applicationKeys += 'f1';\r\n");
  1297.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1298.            $nm_saida->saida("     applicationKeys += 'ctrl+p';\r\n");
  1299.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1300.            $nm_saida->saida("     applicationKeys += 'alt+p';\r\n");
  1301.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1302.            $nm_saida->saida("     applicationKeys += 'alt+w';\r\n");
  1303.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1304.            $nm_saida->saida("     applicationKeys += 'alt+x';\r\n");
  1305.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1306.            $nm_saida->saida("     applicationKeys += 'alt+m';\r\n");
  1307.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1308.            $nm_saida->saida("     applicationKeys += 'alt+c';\r\n");
  1309.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1310.            $nm_saida->saida("     applicationKeys += 'alt+r';\r\n");
  1311.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1312.            $nm_saida->saida("     applicationKeys += 'alt+shift+p';\r\n");
  1313.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1314.            $nm_saida->saida("     applicationKeys += 'alt+shift+w';\r\n");
  1315.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1316.            $nm_saida->saida("     applicationKeys += 'alt+shift+x';\r\n");
  1317.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1318.            $nm_saida->saida("     applicationKeys += 'alt+shift+m';\r\n");
  1319.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1320.            $nm_saida->saida("     applicationKeys += 'alt+shift+c';\r\n");
  1321.            $nm_saida->saida("     applicationKeys += ',';\r\n");
  1322.            $nm_saida->saida("     applicationKeys += 'alt+shift+r';\r\n");
  1323.            $nm_saida->saida("     var hotkeyList = '';\r\n");
  1324.            $nm_saida->saida("     function execHotKey(e, h) {\r\n");
  1325.            $nm_saida->saida("         var hotkey_fired = false\r\n");
  1326.            $nm_saida->saida("         switch (true) {\r\n");
  1327.            $nm_saida->saida("             case (['ctrl+shift+right'].indexOf(h.key) > -1):\r\n");
  1328.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_fim');\r\n");
  1329.            $nm_saida->saida("                 break;\r\n");
  1330.            $nm_saida->saida("             case (['ctrl+shift+left'].indexOf(h.key) > -1):\r\n");
  1331.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_ini');\r\n");
  1332.            $nm_saida->saida("                 break;\r\n");
  1333.            $nm_saida->saida("             case (['ctrl+right'].indexOf(h.key) > -1):\r\n");
  1334.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_ava');\r\n");
  1335.            $nm_saida->saida("                 break;\r\n");
  1336.            $nm_saida->saida("             case (['ctrl+left'].indexOf(h.key) > -1):\r\n");
  1337.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_ret');\r\n");
  1338.            $nm_saida->saida("                 break;\r\n");
  1339.            $nm_saida->saida("             case (['alt+q'].indexOf(h.key) > -1):\r\n");
  1340.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_sai');\r\n");
  1341.            $nm_saida->saida("                 break;\r\n");
  1342.            $nm_saida->saida("             case (['ctrl+f'].indexOf(h.key) > -1):\r\n");
  1343.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_fil');\r\n");
  1344.            $nm_saida->saida("                 break;\r\n");
  1345.            $nm_saida->saida("             case (['ctrl+s'].indexOf(h.key) > -1):\r\n");
  1346.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_savegrid');\r\n");
  1347.            $nm_saida->saida("                 break;\r\n");
  1348.            $nm_saida->saida("             case (['alt+enter'].indexOf(h.key) > -1):\r\n");
  1349.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_res');\r\n");
  1350.            $nm_saida->saida("                 break;\r\n");
  1351.            $nm_saida->saida("             case (['f1'].indexOf(h.key) > -1):\r\n");
  1352.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_webh');\r\n");
  1353.            $nm_saida->saida("                 break;\r\n");
  1354.            $nm_saida->saida("             case (['ctrl+p'].indexOf(h.key) > -1):\r\n");
  1355.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_imp');\r\n");
  1356.            $nm_saida->saida("                 break;\r\n");
  1357.            $nm_saida->saida("             case (['alt+p'].indexOf(h.key) > -1):\r\n");
  1358.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_pdf');\r\n");
  1359.            $nm_saida->saida("                 break;\r\n");
  1360.            $nm_saida->saida("             case (['alt+w'].indexOf(h.key) > -1):\r\n");
  1361.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_word');\r\n");
  1362.            $nm_saida->saida("                 break;\r\n");
  1363.            $nm_saida->saida("             case (['alt+x'].indexOf(h.key) > -1):\r\n");
  1364.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_xls');\r\n");
  1365.            $nm_saida->saida("                 break;\r\n");
  1366.            $nm_saida->saida("             case (['alt+m'].indexOf(h.key) > -1):\r\n");
  1367.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_xml');\r\n");
  1368.            $nm_saida->saida("                 break;\r\n");
  1369.            $nm_saida->saida("             case (['alt+c'].indexOf(h.key) > -1):\r\n");
  1370.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_csv');\r\n");
  1371.            $nm_saida->saida("                 break;\r\n");
  1372.            $nm_saida->saida("             case (['alt+r'].indexOf(h.key) > -1):\r\n");
  1373.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_rtf');\r\n");
  1374.            $nm_saida->saida("                 break;\r\n");
  1375.            $nm_saida->saida("             case (['alt+shift+p'].indexOf(h.key) > -1):\r\n");
  1376.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_pdf');\r\n");
  1377.            $nm_saida->saida("                 break;\r\n");
  1378.            $nm_saida->saida("             case (['alt+shift+w'].indexOf(h.key) > -1):\r\n");
  1379.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_word');\r\n");
  1380.            $nm_saida->saida("                 break;\r\n");
  1381.            $nm_saida->saida("             case (['alt+shift+x'].indexOf(h.key) > -1):\r\n");
  1382.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_xls');\r\n");
  1383.            $nm_saida->saida("                 break;\r\n");
  1384.            $nm_saida->saida("             case (['alt+shift+m'].indexOf(h.key) > -1):\r\n");
  1385.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_xml');\r\n");
  1386.            $nm_saida->saida("                 break;\r\n");
  1387.            $nm_saida->saida("             case (['alt+shift+c'].indexOf(h.key) > -1):\r\n");
  1388.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_csv');\r\n");
  1389.            $nm_saida->saida("                 break;\r\n");
  1390.            $nm_saida->saida("             case (['alt+shift+r'].indexOf(h.key) > -1):\r\n");
  1391.            $nm_saida->saida("                 hotkey_fired = process_hotkeys('sys_format_email_rtf');\r\n");
  1392.            $nm_saida->saida("                 break;\r\n");
  1393.            $nm_saida->saida("         }\r\n");
  1394.            $nm_saida->saida("         if (hotkey_fired) {\r\n");
  1395.            $nm_saida->saida("             e.preventDefault();\r\n");
  1396.            $nm_saida->saida("             return false;\r\n");
  1397.            $nm_saida->saida("         } else {\r\n");
  1398.            $nm_saida->saida("             return true;\r\n");
  1399.            $nm_saida->saida("         }\r\n");
  1400.            $nm_saida->saida("     }\r\n");
  1401.            $nm_saida->saida("   </script>\r\n");
  1402.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/hotkeys.inc.js\"></script>\r\n");
  1403.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/hotkeys_setup.js\"></script>\r\n");
  1404.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/jquery/js/jquery-ui.js\"></script>\r\n");
  1405.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"" $this->Ini->path_prod "/third/jquery/css/smoothness/jquery-ui.css\" type=\"text/css\" media=\"screen\" />\r\n");
  1406.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"" $this->Ini->path_prod "/third/font-awesome/css/all.min.css\" type=\"text/css\" media=\"screen\" />\r\n");
  1407.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/jquery_plugin/touch_punch/jquery.ui.touch-punch.min.js\"></script>\r\n");
  1408.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/jquery_plugin/malsup-blockui/jquery.blockUI.js\"></script>\r\n");
  1409.            $nm_saida->saida("        <script type=\"text/javascript\">\r\n");
  1410.            $nm_saida->saida("          var sc_pathToTB = '" $this->Ini->path_prod "/third/jquery_plugin/thickbox/';\r\n");
  1411.            $nm_saida->saida("          var sc_tbLangClose = \"" html_entity_decode($this->Ini->Nm_lang['lang_tb_close'], ENT_COMPAT$_SESSION['scriptcase']['charset']) . "\";\r\n");
  1412.            $nm_saida->saida("          var sc_tbLangEsc = \"" html_entity_decode($this->Ini->Nm_lang['lang_tb_esc'], ENT_COMPAT$_SESSION['scriptcase']['charset']) . "\";\r\n");
  1413.            $nm_saida->saida("        </script>\r\n");
  1414.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/jquery_plugin/thickbox/thickbox-compressed.js\"></script>\r\n");
  1415.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/scInput.js\"></script>\r\n");
  1416.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/jquery.scInput.js\"></script>\r\n");
  1417.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/jquery.scInput2.js\"></script>\r\n");
  1418.            $nm_saida->saida("   <script type=\"text/javascript\" src=\"../_lib/lib/js/bluebird.min.js\"></script>\r\n");
  1419.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"" $this->Ini->path_prod "/third/jquery_plugin/thickbox/thickbox.css\" type=\"text/css\" media=\"screen\" />\r\n");
  1420.            $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/buttons/" $this->Ini->Str_btn_css "\" /> \r\n");
  1421.            $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" $this->Ini->str_schema_all "_form.css\" /> \r\n");
  1422.            $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" $this->Ini->str_schema_all "_form" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" /> \r\n");
  1423.            $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" $this->Ini->str_schema_all "_filter.css\" /> \r\n");
  1424.            $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" $this->Ini->str_schema_all "_filter" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" /> \r\n");
  1425.            $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" $this->Ini->str_schema_all "_appdiv.css\" /> \r\n");
  1426.            $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" $this->Ini->str_schema_all "_appdiv" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" /> \r\n");
  1427.            $nm_saida->saida("   <style type=\"text/css\"> \r\n");
  1428.            $nm_saida->saida("     .scGridLabelFont a img[src\$='" $this->Ini->Label_sort_desc "'], \r\n");
  1429.            $nm_saida->saida("     .scGridLabelFont a img[src\$='" $this->Ini->Label_sort_asc "'], \r\n");
  1430.            $nm_saida->saida("     .scGridLabelFont a img[src\$='" $this->arr_buttons['bgraf']['image'] . "'], \r\n");
  1431.            $nm_saida->saida("     .scGridLabelFont a img[src\$='" $this->arr_buttons['bconf_graf']['image'] . "']{opacity:1!important;} \r\n");
  1432.            $nm_saida->saida("     .scGridLabelFont a img{opacity:0;transition:all .2s;} \r\n");
  1433.            $nm_saida->saida("     .scGridLabelFont:HOVER a img{opacity:1;transition:all .2s;} \r\n");
  1434.            $nm_saida->saida("   </style> \r\n");
  1435.            $nm_saida->saida("   <style type=\"text/css\">\r\n");
  1436.            $nm_saida->saida("     #quicksearchph_top {\r\n");
  1437.            $nm_saida->saida("       position: relative;\r\n");
  1438.            $nm_saida->saida("     }\r\n");
  1439.            $nm_saida->saida("     #quicksearchph_top img {\r\n");
  1440.            $nm_saida->saida("       position: absolute;\r\n");
  1441.            $nm_saida->saida("       top: 0;\r\n");
  1442.            $nm_saida->saida("       right: 0;\r\n");
  1443.            $nm_saida->saida("     }\r\n");
  1444.            $nm_saida->saida("   </style>\r\n");
  1445.            $nm_saida->saida("   <script type=\"text/javascript\"> \r\n");
  1446.            if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1447.            { 
  1448.                $nm_saida->saida("   function sc_session_redir(url_redir)\r\n");
  1449.                $nm_saida->saida("   {\r\n");
  1450.                $nm_saida->saida("       if (window.parent && window.parent.document != window.document && typeof window.parent.sc_session_redir === 'function')\r\n");
  1451.                $nm_saida->saida("       {\r\n");
  1452.                $nm_saida->saida("           window.parent.sc_session_redir(url_redir);\r\n");
  1453.                $nm_saida->saida("       }\r\n");
  1454.                $nm_saida->saida("       else\r\n");
  1455.                $nm_saida->saida("       {\r\n");
  1456.                $nm_saida->saida("           if (window.opener && typeof window.opener.sc_session_redir === 'function')\r\n");
  1457.                $nm_saida->saida("           {\r\n");
  1458.                $nm_saida->saida("               window.close();\r\n");
  1459.                $nm_saida->saida("               window.opener.sc_session_redir(url_redir);\r\n");
  1460.                $nm_saida->saida("           }\r\n");
  1461.                $nm_saida->saida("           else\r\n");
  1462.                $nm_saida->saida("           {\r\n");
  1463.                $nm_saida->saida("               window.location = url_redir;\r\n");
  1464.                $nm_saida->saida("           }\r\n");
  1465.                $nm_saida->saida("       }\r\n");
  1466.                $nm_saida->saida("   }\r\n");
  1467.            }
  1468.            $nm_saida->saida("   var scBtnGrpStatus = {};\r\n");
  1469.            $nm_saida->saida("   var SC_Link_View = false;\r\n");
  1470.            if ($this->Ini->SC_Link_View)
  1471.            {
  1472.                $nm_saida->saida("   SC_Link_View = true;\r\n");
  1473.            }
  1474.            $nm_saida->saida("   var Qsearch_ok = true;\r\n");
  1475.            if (!$this->Ini->SC_Link_View && $this->nmgp_botoes['qsearch'] != "on")
  1476.            {
  1477.                $nm_saida->saida("   Qsearch_ok = false;\r\n");
  1478.            }
  1479.            $nm_saida->saida("   var scQSInit = true;\r\n");
  1480.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] || $this->Ini->Apl_paginacao == "FULL")
  1481.            {
  1482.                $nm_saida->saida("   var scQtReg  = " NM_encode_input($this->count_ger) . ";\r\n");
  1483.            }
  1484.            else
  1485.            {
  1486.                $nm_saida->saida("   var scQtReg  = " NM_encode_input($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid']) . ";\r\n");
  1487.            }
  1488.            $nm_saida->saida("   var Dyn_Ini   = true;\r\n");
  1489.            $nm_saida->saida("   var nmdg_Form = \"Fdyn_search\";\r\n");
  1490.            if (is_file($this->Ini->root $this->Ini->path_link "_lib/js/tab_erro_" $this->Ini->str_lang ".js"))
  1491.            {
  1492.                $Tb_err_js file($this->Ini->root $this->Ini->path_link "_lib/js/tab_erro_" $this->Ini->str_lang ".js");
  1493.                foreach ($Tb_err_js as $Lines)
  1494.                {
  1495.                    if (NM_is_utf8($Lines) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  1496.                    {
  1497.                        $Lines sc_convert_encoding($Lines$_SESSION['scriptcase']['charset'], "UTF-8");
  1498.                    }
  1499.                    echo "   " $Lines;
  1500.                }
  1501.            }
  1502.            if (NM_is_utf8($Lines) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  1503.            {
  1504.                $Msg_Inval sc_convert_encoding("Inv�lido"$_SESSION['scriptcase']['charset'], "UTF-8");
  1505.            }
  1506.            echo "   var SC_crit_inv = \"" $Msg_Inval "\";\r\n";
  1507.            $gridWidthCorrection '';
  1508.            if (false !== strpos($this->Ini->grid_table_width'calc')) {
  1509.                $gridWidthCalc substr($this->Ini->grid_table_widthstrpos($this->Ini->grid_table_width'(') + 1);
  1510.                $gridWidthCalc substr($gridWidthCalc0strpos($gridWidthCalc')'));
  1511.                $gridWidthParts explode(' '$gridWidthCalc);
  1512.                if (== count($gridWidthParts) && 'px' == substr($gridWidthParts[2], -2)) {
  1513.                    $gridWidthParts[2] = substr($gridWidthParts[2], 0, -2) / 2;
  1514.                    $gridWidthCorrection $gridWidthParts[1] . ' ' $gridWidthParts[2];
  1515.                }
  1516.            }
  1517.            $nm_saida->saida("  function scSetFixedHeaders() {\r\n");
  1518.            $nm_saida->saida("   var divScroll, gridHeaders, headerPlaceholder;\r\n");
  1519.            $nm_saida->saida("   gridHeaders = scGetHeaderRow();\r\n");
  1520.            $nm_saida->saida("   headerPlaceholder = $(\"#sc-id-fixedheaders-placeholder\");\r\n");
  1521.            $nm_saida->saida("   if (!gridHeaders) {\r\n");
  1522.            $nm_saida->saida("     headerPlaceholder.hide();\r\n");
  1523.            $nm_saida->saida("   }\r\n");
  1524.            $nm_saida->saida("   else {\r\n");
  1525.            $nm_saida->saida("    scSetFixedHeadersContents(gridHeaders, headerPlaceholder);\r\n");
  1526.            $nm_saida->saida("    scSetFixedHeadersSize(gridHeaders);\r\n");
  1527.            $nm_saida->saida("    scSetFixedHeadersPosition(gridHeaders, headerPlaceholder);\r\n");
  1528.            $nm_saida->saida("    if (scIsHeaderVisible(gridHeaders)) {\r\n");
  1529.            $nm_saida->saida("     headerPlaceholder.hide();\r\n");
  1530.            $nm_saida->saida("    }\r\n");
  1531.            $nm_saida->saida("    else {\r\n");
  1532.            $nm_saida->saida("     headerPlaceholder.show();\r\n");
  1533.            $nm_saida->saida("    }\r\n");
  1534.            $nm_saida->saida("   }\r\n");
  1535.            $nm_saida->saida("  }\r\n");
  1536.            $nm_saida->saida("  function scSetFixedHeadersPosition(gridHeaders, headerPlaceholder) {\r\n");
  1537.            $nm_saida->saida("   if(gridHeaders)\r\n");
  1538.            $nm_saida->saida("   {\r\n");
  1539.            $nm_saida->saida("       headerPlaceholder.css({\"top\": 0" $gridWidthCorrection ", \"left\": (Math.floor(gridHeaders.position().left) - $(document).scrollLeft()" $gridWidthCorrection ") + \"px\"});\r\n");
  1540.            $nm_saida->saida("   }\r\n");
  1541.            $nm_saida->saida("  }\r\n");
  1542.            $nm_saida->saida("  function scIsHeaderVisible(gridHeaders) {\r\n");
  1543.            $nm_saida->saida("   if (typeof(scIsHeaderVisibleMobile) === typeof(function(){})) { return scIsHeaderVisibleMobile(gridHeaders); }\r\n");
  1544.            $nm_saida->saida("   return gridHeaders.offset().top > $(document).scrollTop();\r\n");
  1545.            $nm_saida->saida("  }\r\n");
  1546.            $nm_saida->saida("  function scGetHeaderRow() {\r\n");
  1547.            $nm_saida->saida("   var gridHeaders = $(\".sc-ui-grid-header-row-grid_new-1\"), headerDisplayed = true;\r\n");
  1548.            $nm_saida->saida("   if (!gridHeaders.length) {\r\n");
  1549.            $nm_saida->saida("    headerDisplayed = false;\r\n");
  1550.            $nm_saida->saida("   }\r\n");
  1551.            $nm_saida->saida("   else {\r\n");
  1552.            $nm_saida->saida("    if (!gridHeaders.filter(\":visible\").length) {\r\n");
  1553.            $nm_saida->saida("     headerDisplayed = false;\r\n");
  1554.            $nm_saida->saida("    }\r\n");
  1555.            $nm_saida->saida("   }\r\n");
  1556.            $nm_saida->saida("   if (!headerDisplayed) {\r\n");
  1557.            $nm_saida->saida("    gridHeaders = $(\".sc-ui-grid-header-row\").filter(\":visible\");\r\n");
  1558.            $nm_saida->saida("    if (gridHeaders.length) {\r\n");
  1559.            $nm_saida->saida("     gridHeaders = $(gridHeaders[0]);\r\n");
  1560.            $nm_saida->saida("    }\r\n");
  1561.            $nm_saida->saida("    else {\r\n");
  1562.            $nm_saida->saida("     gridHeaders = false;\r\n");
  1563.            $nm_saida->saida("    }\r\n");
  1564.            $nm_saida->saida("   }\r\n");
  1565.            $nm_saida->saida("   return gridHeaders;\r\n");
  1566.            $nm_saida->saida("  }\r\n");
  1567.            $nm_saida->saida("  function scSetFixedHeadersContents(gridHeaders, headerPlaceholder) {\r\n");
  1568.            $nm_saida->saida("   var i, htmlContent;\r\n");
  1569.            $nm_saida->saida("   htmlContent = \"<table id=\\\"sc-id-fixed-headers\\\" class=\\\"scGridTabela\\\">\";\r\n");
  1570.            $nm_saida->saida("   for (i = 0; i < gridHeaders.length; i++) {\r\n");
  1571.            $nm_saida->saida("    htmlContent += \"<tr class=\\\"scGridLabel\\\" id=\\\"sc-id-fixed-headers-row-\" + i + \"\\\">\" + $(gridHeaders[i]).html() + \"</tr>\";\r\n");
  1572.            $nm_saida->saida("   }\r\n");
  1573.            $nm_saida->saida("   htmlContent += \"</table>\";\r\n");
  1574.            $nm_saida->saida("   headerPlaceholder.html(htmlContent);\r\n");
  1575.            $nm_saida->saida("  }\r\n");
  1576.            $nm_saida->saida("  function scSetFixedHeadersSize(gridHeaders) {\r\n");
  1577.            $nm_saida->saida("   var i, j, headerColumns, gridColumns, cellHeight, cellWidth, tableOriginal, tableHeaders;\r\n");
  1578.            $nm_saida->saida("   tableOriginal = document.getElementById(\"sc-ui-grid-body-de1543de\");\r\n");
  1579.            $nm_saida->saida("   tableHeaders = document.getElementById(\"sc-id-fixed-headers\");\r\n");
  1580.            $nm_saida->saida("    tableWidth = $(tableOriginal).outerWidth();\r\n");
  1581.            $nm_saida->saida("   $(tableHeaders).css(\"width\", tableWidth);\r\n");
  1582.            $nm_saida->saida("   for (i = 0; i < gridHeaders.length; i++) {\r\n");
  1583.            $nm_saida->saida("    headerColumns = $(\"#sc-id-fixed-headers-row-\" + i).find(\"td\");\r\n");
  1584.            $nm_saida->saida("    gridColumns = $(gridHeaders[i]).find(\"td\");\r\n");
  1585.            $nm_saida->saida("    for (j = 0; j < gridColumns.length; j++) {\r\n");
  1586.            $nm_saida->saida("     if (window.getComputedStyle(gridColumns[j])) {\r\n");
  1587.            $nm_saida->saida("      cellWidth = window.getComputedStyle(gridColumns[j]).width;\r\n");
  1588.            $nm_saida->saida("      cellHeight = window.getComputedStyle(gridColumns[j]).height;\r\n");
  1589.            $nm_saida->saida("     }\r\n");
  1590.            $nm_saida->saida("     else {\r\n");
  1591.            $nm_saida->saida("      cellWidth = $(gridColumns[j]).width() + \"px\";\r\n");
  1592.            $nm_saida->saida("      cellHeight = $(gridColumns[j]).height() + \"px\";\r\n");
  1593.            $nm_saida->saida("     }\r\n");
  1594.            $nm_saida->saida("     $(headerColumns[j]).css({\r\n");
  1595.            $nm_saida->saida("      \"width\": cellWidth,\r\n");
  1596.            $nm_saida->saida("      \"height\": cellHeight\r\n");
  1597.            $nm_saida->saida("     });\r\n");
  1598.            $nm_saida->saida("    }\r\n");
  1599.            $nm_saida->saida("   }\r\n");
  1600.            $nm_saida->saida("  }\r\n");
  1601.            $nm_saida->saida("  function SC_init_jquery(isScrollNav){ \r\n");
  1602.            $nm_saida->saida("   \$(function(){ \r\n");
  1603.            $nm_saida->saida("     if (Dyn_Ini)\r\n");
  1604.            $nm_saida->saida("     {\r\n");
  1605.            $nm_saida->saida("         Dyn_Ini = false;\r\n");
  1606.            if ($nmgrp_apl_opcao != "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != 'print' && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']))
  1607.            { 
  1608.            $nm_saida->saida("         SC_carga_evt_jquery_grid('all');\r\n");
  1609.            } 
  1610.            $nm_saida->saida("         scLoadScInput('input:text.sc-js-input');\r\n");
  1611.            $nm_saida->saida("     }\r\n");
  1612.            if (!$this->Ini->SC_Link_View && $this->nmgp_botoes['qsearch'] == "on")
  1613.            {
  1614.                $nm_saida->saida("     \$('#SC_fast_search_top').keyup(function(e) {\r\n");
  1615.                $nm_saida->saida("       scQuickSearchKeyUp('top', e);\r\n");
  1616.                $nm_saida->saida("     });\r\n");
  1617.            }
  1618.            $nm_saida->saida("     $('#id_F0_top').keyup(function(e) {\r\n");
  1619.            $nm_saida->saida("       var keyPressed = e.charCode || e.keyCode || e.which;\r\n");
  1620.            $nm_saida->saida("       if (13 == keyPressed) {\r\n");
  1621.            $nm_saida->saida("          return false; \r\n");
  1622.            $nm_saida->saida("       }\r\n");
  1623.            $nm_saida->saida("     });\r\n");
  1624.            $nm_saida->saida("     $('#id_F0_bot').keyup(function(e) {\r\n");
  1625.            $nm_saida->saida("       var keyPressed = e.charCode || e.keyCode || e.which;\r\n");
  1626.            $nm_saida->saida("       if (13 == keyPressed) {\r\n");
  1627.            $nm_saida->saida("          return false; \r\n");
  1628.            $nm_saida->saida("       }\r\n");
  1629.            $nm_saida->saida("     });\r\n");
  1630.            $nm_saida->saida("     $(\".scBtnGrpText\").mouseover(function() { $(this).addClass(\"scBtnGrpTextOver\"); }).mouseout(function() { $(this).removeClass(\"scBtnGrpTextOver\"); });\r\n");
  1631.            $nm_saida->saida("     $(\".scBtnGrpClick\").mouseup(function(event){\r\n");
  1632.            $nm_saida->saida("          event.preventDefault();\r\n");
  1633.            $nm_saida->saida("          if(event.target !== event.currentTarget) return;\r\n");
  1634.            $nm_saida->saida("          if($(this).find(\"a\").prop('href') != '')\r\n");
  1635.            $nm_saida->saida("          {\r\n");
  1636.            $nm_saida->saida("              $(this).find(\"a\").click();\r\n");
  1637.            $nm_saida->saida("          }\r\n");
  1638.            $nm_saida->saida("          else\r\n");
  1639.            $nm_saida->saida("          {\r\n");
  1640.            $nm_saida->saida("              eval($(this).find(\"a\").prop('onclick'));\r\n");
  1641.            $nm_saida->saida("          }\r\n");
  1642.            $nm_saida->saida("     });\r\n");
  1643.            $nm_saida->saida("   }); \r\n");
  1644.            $nm_saida->saida("  }\r\n");
  1645.            $nm_saida->saida("  SC_init_jquery(false);\r\n");
  1646.            $nm_saida->saida("   \$(window).on('load', function() {\r\n");
  1647.            if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ancor_save']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ancor_save']))
  1648.            {
  1649.                $nm_saida->saida("       var catTopPosition = jQuery('#SC_ancor" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ancor_save'] . "').offset().top;\r\n");
  1650.                $nm_saida->saida("       jQuery('html, body').animate({scrollTop:catTopPosition}, 'fast');\r\n");
  1651.                $nm_saida->saida("       $('#SC_ancor" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ancor_save'] . "').addClass('" $this->css_scGridFieldOver "');\r\n");
  1652.                unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ancor_save']);
  1653.            }
  1654.            if (!$this->Ini->SC_Link_View && $this->nmgp_botoes['qsearch'] == "on")
  1655.            {
  1656.                $nm_saida->saida("     scQuickSearchInit(false, '');\r\n");
  1657.                $nm_saida->saida("     scQuickSearchKeyUp('top', null);\r\n");
  1658.                $nm_saida->saida("     scQSInit = false;\r\n");
  1659.            }
  1660.            $nm_saida->saida("   });\r\n");
  1661.            $nm_saida->saida("   function scQuickSearchSubmit_top() {\r\n");
  1662.            $nm_saida->saida("     document.F0_top.nmgp_opcao.value = 'fast_search';\r\n");
  1663.            $nm_saida->saida("     document.F0_top.submit();\r\n");
  1664.            $nm_saida->saida("   }\r\n");
  1665.            $nm_saida->saida("   function scQuickSearchInit(bPosOnly, sPos) {\r\n");
  1666.            $nm_saida->saida("     if (!bPosOnly) {\r\n");
  1667.            $nm_saida->saida("       if ('' == sPos || 'top' == sPos) scQuickSearchSize('SC_fast_search_top', 'SC_fast_search_close_top', 'SC_fast_search_submit_top', 'quicksearchph_top');\r\n");
  1668.            $nm_saida->saida("     }\r\n");
  1669.            $nm_saida->saida("   }\r\n");
  1670.            $nm_saida->saida("   var fixedQuickSearchSize = {};\r\n");
  1671.            $nm_saida->saida("   function scQuickSearchSize(sIdInput, sIdClose, sIdSubmit, sPlaceHolder) {\r\n");
  1672.            $nm_saida->saida("     if($('#' + sIdInput).length)\r\n");
  1673.            $nm_saida->saida("     {\r\n");
  1674.            $nm_saida->saida("         if (\"boolean\" == typeof fixedQuickSearchSize[sIdInput] && fixedQuickSearchSize[sIdInput]) {\r\n");
  1675.            $nm_saida->saida("             return;\r\n");
  1676.            $nm_saida->saida("         }\r\n");
  1677.            $nm_saida->saida("         var oInput = $('#' + sIdInput),\r\n");
  1678.            $nm_saida->saida("             oClose = $('#' + sIdClose),\r\n");
  1679.            $nm_saida->saida("             oSubmit = $('#' + sIdSubmit),\r\n");
  1680.            $nm_saida->saida("             oPlace = $('#' + sPlaceHolder),\r\n");
  1681.            $nm_saida->saida("             iInputP = parseInt(oInput.css('padding-right')) || 0,\r\n");
  1682.            $nm_saida->saida("             iInputB = parseInt(oInput.css('border-right-width')) || 0,\r\n");
  1683.            $nm_saida->saida("             iInputW = oInput.outerWidth(),\r\n");
  1684.            $nm_saida->saida("             iPlaceW = oPlace.outerWidth(),\r\n");
  1685.            $nm_saida->saida("             oInputO = oInput.offset(),\r\n");
  1686.            $nm_saida->saida("             oPlaceO = oPlace.offset(),\r\n");
  1687.            $nm_saida->saida("             iNewRight;\r\n");
  1688.            $nm_saida->saida("         iNewRight = (iPlaceW - iInputW) - (oInputO.left - oPlaceO.left) + iInputB + 1;\r\n");
  1689.            $nm_saida->saida("         oInput.css({\r\n");
  1690.            $nm_saida->saida("           'height': Math.max(oInput.height(), 16) + 'px',\r\n");
  1691.            $nm_saida->saida("           'padding-right': iInputP + 16 + " $this->Ini->Str_qs_image_padding " + 'px'\r\n");
  1692.            $nm_saida->saida("         });\r\n");
  1693.            $nm_saida->saida("         oClose.css({\r\n");
  1694.            $nm_saida->saida("           'right': iNewRight + " $this->Ini->Str_qs_image_padding " + 'px',\r\n");
  1695.            $nm_saida->saida("           'cursor': 'pointer'\r\n");
  1696.            $nm_saida->saida("         });\r\n");
  1697.            $nm_saida->saida("         oSubmit.css({\r\n");
  1698.            $nm_saida->saida("           'right': iNewRight + " $this->Ini->Str_qs_image_padding " + 'px',\r\n");
  1699.            $nm_saida->saida("           'cursor': 'pointer'\r\n");
  1700.            $nm_saida->saida("         });\r\n");
  1701.            $nm_saida->saida("         fixedQuickSearchSize[sIdInput] = true;\r\n");
  1702.            $nm_saida->saida("     }\r\n");
  1703.            $nm_saida->saida("   }\r\n");
  1704.            $nm_saida->saida("   function scQuickSearchKeyUp(sPos, e) {\r\n");
  1705.            $nm_saida->saida("    if(typeof scQSInitVal !== 'undefined')\r\n");
  1706.            $nm_saida->saida("    {\r\n");
  1707.            $nm_saida->saida("     if ('' != scQSInitVal && $('#SC_fast_search_' + sPos).val() == scQSInitVal && scQSInit) {\r\n");
  1708.            $nm_saida->saida("       $('#SC_fast_search_close_' + sPos).show();\r\n");
  1709.            $nm_saida->saida("       $('#SC_fast_search_submit_' + sPos).hide();\r\n");
  1710.            $nm_saida->saida("     }\r\n");
  1711.            $nm_saida->saida("     else {\r\n");
  1712.            $nm_saida->saida("       $('#SC_fast_search_close_' + sPos).hide();\r\n");
  1713.            $nm_saida->saida("       $('#SC_fast_search_submit_' + sPos).show();\r\n");
  1714.            $nm_saida->saida("     }\r\n");
  1715.            $nm_saida->saida("     if (null != e) {\r\n");
  1716.            $nm_saida->saida("       var keyPressed = e.charCode || e.keyCode || e.which;\r\n");
  1717.            $nm_saida->saida("       if (13 == keyPressed) {\r\n");
  1718.            $nm_saida->saida("         if ('top' == sPos) nm_gp_submit_qsearch('top');\r\n");
  1719.            $nm_saida->saida("       }\r\n");
  1720.            $nm_saida->saida("     }\r\n");
  1721.            $nm_saida->saida("    }\r\n");
  1722.            $nm_saida->saida("   }\r\n");
  1723.            $nm_saida->saida("   function scBtnGroupByShow(sUrl, sPos) {\r\n");
  1724.            $nm_saida->saida("     if ($(\"#sc_id_groupby_placeholder_\" + sPos).css('display') != 'none') {\r\n");
  1725.            $nm_saida->saida("         scBtnGroupByHide(sPos);\r\n");
  1726.            $nm_saida->saida("         $(\"#sel_groupby_\" + sPos).removeClass(\"selected\");\r\n");
  1727.            $nm_saida->saida("         return;\r\n");
  1728.            $nm_saida->saida("     }\r\n");
  1729.            $nm_saida->saida("     $.ajax({\r\n");
  1730.            $nm_saida->saida("       type: \"GET\",\r\n");
  1731.            $nm_saida->saida("       dataType: \"html\",\r\n");
  1732.            $nm_saida->saida("       url: sUrl\r\n");
  1733.            $nm_saida->saida("     }).done(function(data) {\r\n");
  1734.            $nm_saida->saida("       $(\"#sc_id_groupby_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
  1735.            $nm_saida->saida("       $(\"#sc_id_groupby_placeholder_\" + sPos).find(\"td\").html(data);\r\n");
  1736.            $nm_saida->saida("       $(\"#sc_id_groupby_placeholder_\" + sPos).show();\r\n");
  1737.            $nm_saida->saida("     });\r\n");
  1738.            $nm_saida->saida("   }\r\n");
  1739.            $nm_saida->saida("   function scBtnGroupByHide(sPos) {\r\n");
  1740.            $nm_saida->saida("     $(\"#sc_id_groupby_placeholder_\" + sPos).hide();\r\n");
  1741.            $nm_saida->saida("     $(\"#sc_id_groupby_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
  1742.            $nm_saida->saida("   }\r\n");
  1743.            $nm_saida->saida("   function scBtnSaveGridShow(origem, embbed, pos) {\r\n");
  1744.            $nm_saida->saida("     if ($(\"#sc_id_save_grid_placeholder_\" + pos).css('display') != 'none') {\r\n");
  1745.            $nm_saida->saida("         $(\"#save_grid_\" + pos).removeClass(\"selected\")\r\n");
  1746.            $nm_saida->saida("         scBtnSaveGridHide(pos);\r\n");
  1747.            $nm_saida->saida("         return;\r\n");
  1748.            $nm_saida->saida("     }\r\n");
  1749.            $nm_saida->saida("     $.ajax({\r\n");
  1750.            $nm_saida->saida("       type: \"POST\",\r\n");
  1751.            $nm_saida->saida("       dataType: \"html\",\r\n");
  1752.            $nm_saida->saida("       url: \"grid_new_save_grid.php\",\r\n");
  1753.            $nm_saida->saida("       data: \"path_img=" $this->Ini->path_img_global "&path_btn=" $this->Ini->path_botoes "&script_case_init=" $this->Ini->sc_page "&script_case_session=" session_id() . "&script_origem=\" + origem + \"&embbed_groupby=\" + embbed + \"&toolbar_pos=\" + pos\r\n");
  1754.            $nm_saida->saida("     }).done(function(data) {\r\n");
  1755.            $nm_saida->saida("       $(\"#sc_id_save_grid_placeholder_\" + pos).find(\"td\").html(\"\");\r\n");
  1756.            $nm_saida->saida("       $(\"#sc_id_save_grid_placeholder_\" + pos).find(\"td\").html(data);\r\n");
  1757.            $nm_saida->saida("       $(\"#sc_id_save_grid_placeholder_\" + pos).show();\r\n");
  1758.            $nm_saida->saida("     });\r\n");
  1759.            $nm_saida->saida("   }\r\n");
  1760.            $nm_saida->saida("   function scBtnSaveGridHide(sPos) {\r\n");
  1761.            $nm_saida->saida("     $(\"#sc_id_save_grid_placeholder_\" + sPos).hide();\r\n");
  1762.            $nm_saida->saida("     $(\"#sc_id_save_grid_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
  1763.            $nm_saida->saida("   }\r\n");
  1764.            $nm_saida->saida("   function scBtnSelCamposShow(sUrl, sPos) {\r\n");
  1765.            $nm_saida->saida("     if ($(\"#sc_id_sel_campos_placeholder_\" + sPos).css('display') != 'none') {\r\n");
  1766.            $nm_saida->saida("         scBtnSelCamposHide(sPos);\r\n");
  1767.            $nm_saida->saida("         $(\"#selcmp_\" + sPos).removeClass(\"selected\");\r\n");
  1768.            $nm_saida->saida("         return;\r\n");
  1769.            $nm_saida->saida("     }\r\n");
  1770.            $nm_saida->saida("     $.ajax({\r\n");
  1771.            $nm_saida->saida("       type: \"GET\",\r\n");
  1772.            $nm_saida->saida("       dataType: \"html\",\r\n");
  1773.            $nm_saida->saida("       url: sUrl\r\n");
  1774.            $nm_saida->saida("     }).done(function(data) {\r\n");
  1775.            $nm_saida->saida("       $(\"#sc_id_sel_campos_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
  1776.            $nm_saida->saida("       $(\"#sc_id_sel_campos_placeholder_\" + sPos).find(\"td\").html(data);\r\n");
  1777.            $nm_saida->saida("       $(\"#sc_id_sel_campos_placeholder_\" + sPos).show();\r\n");
  1778.            $nm_saida->saida("     });\r\n");
  1779.            $nm_saida->saida("   }\r\n");
  1780.            $nm_saida->saida("   function scBtnSelCamposHide(sPos) {\r\n");
  1781.            $nm_saida->saida("     $(\"#sc_id_sel_campos_placeholder_\" + sPos).hide();\r\n");
  1782.            $nm_saida->saida("     $(\"#sc_id_sel_campos_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
  1783.            $nm_saida->saida("   }\r\n");
  1784.            $nm_saida->saida("   function scBtnOrderCamposShow(sUrl, sPos) {\r\n");
  1785.            $nm_saida->saida("     if ($(\"#sc_id_order_campos_placeholder_\" + sPos).css('display') != 'none') {\r\n");
  1786.            $nm_saida->saida("         scBtnOrderCamposHide(sPos);\r\n");
  1787.            $nm_saida->saida("         $(\"#ordcmp_\" + sPos).removeClass(\"selected\");\r\n");
  1788.            $nm_saida->saida("         return;\r\n");
  1789.            $nm_saida->saida("     }\r\n");
  1790.            $nm_saida->saida("     $.ajax({\r\n");
  1791.            $nm_saida->saida("       type: \"GET\",\r\n");
  1792.            $nm_saida->saida("       dataType: \"html\",\r\n");
  1793.            $nm_saida->saida("       url: sUrl\r\n");
  1794.            $nm_saida->saida("     }).done(function(data) {\r\n");
  1795.            $nm_saida->saida("       $(\"#sc_id_order_campos_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
  1796.            $nm_saida->saida("       $(\"#sc_id_order_campos_placeholder_\" + sPos).find(\"td\").html(data);\r\n");
  1797.            $nm_saida->saida("       $(\"#sc_id_order_campos_placeholder_\" + sPos).show();\r\n");
  1798.            $nm_saida->saida("     });\r\n");
  1799.            $nm_saida->saida("   }\r\n");
  1800.            $nm_saida->saida("   function scBtnOrderCamposHide(sPos) {\r\n");
  1801.            $nm_saida->saida("     $(\"#sc_id_order_campos_placeholder_\" + sPos).hide();\r\n");
  1802.            $nm_saida->saida("     $(\"#sc_id_order_campos_placeholder_\" + sPos).find(\"td\").html(\"\");\r\n");
  1803.            $nm_saida->saida("   }\r\n");
  1804.            $nm_saida->saida("   function scBtnGrpShow(sGroup) {\r\n");
  1805.            $nm_saida->saida("     if (typeof(scBtnGrpShowMobile) === typeof(function(){})) { return scBtnGrpShowMobile(sGroup); };\r\n");
  1806.            $nm_saida->saida("     $('#sc_btgp_btn_' + sGroup).addClass('selected');\r\n");
  1807.            $nm_saida->saida("     var btnPos = $('#sc_btgp_btn_' + sGroup).offset();\r\n");
  1808.            $nm_saida->saida("     scBtnGrpStatus[sGroup] = 'open';\r\n");
  1809.            $nm_saida->saida("     $('#sc_btgp_btn_' + sGroup).mouseout(function() {\r\n");
  1810.            $nm_saida->saida("       scBtnGrpStatus[sGroup] = '';\r\n");
  1811.            $nm_saida->saida("       setTimeout(function() {\r\n");
  1812.            $nm_saida->saida("         scBtnGrpHide(sGroup, false);\r\n");
  1813.            $nm_saida->saida("       }, 1000);\r\n");
  1814.            $nm_saida->saida("     }).mouseover(function() {\r\n");
  1815.            $nm_saida->saida("       scBtnGrpStatus[sGroup] = 'over';\r\n");
  1816.            $nm_saida->saida("     });\r\n");
  1817.            $nm_saida->saida("     $('#sc_btgp_div_' + sGroup + ' span a').click(function() {\r\n");
  1818.            $nm_saida->saida("       scBtnGrpStatus[sGroup] = 'out';\r\n");
  1819.            $nm_saida->saida("       scBtnGrpHide(sGroup, false);\r\n");
  1820.            $nm_saida->saida("     });\r\n");
  1821.            $nm_saida->saida("     $('#sc_btgp_div_' + sGroup).css({\r\n");
  1822.            $nm_saida->saida("       'left': btnPos.left\r\n");
  1823.            $nm_saida->saida("     })\r\n");
  1824.            $nm_saida->saida("     .mouseover(function() {\r\n");
  1825.            $nm_saida->saida("       scBtnGrpStatus[sGroup] = 'over';\r\n");
  1826.            $nm_saida->saida("     })\r\n");
  1827.            $nm_saida->saida("     .mouseleave(function() {\r\n");
  1828.            $nm_saida->saida("       scBtnGrpStatus[sGroup] = 'out';\r\n");
  1829.            $nm_saida->saida("       setTimeout(function() {\r\n");
  1830.            $nm_saida->saida("         scBtnGrpHide(sGroup, false);\r\n");
  1831.            $nm_saida->saida("       }, 1000);\r\n");
  1832.            $nm_saida->saida("     })\r\n");
  1833.            $nm_saida->saida("     .show('fast');\r\n");
  1834.            $nm_saida->saida("   }\r\n");
  1835.            $nm_saida->saida("   function scBtnGrpHide(sGroup, bForce) {\r\n");
  1836.            $nm_saida->saida("     if (bForce || 'over' != scBtnGrpStatus[sGroup]) {\r\n");
  1837.            $nm_saida->saida("       $('#sc_btgp_div_' + sGroup).hide('fast');\r\n");
  1838.            $nm_saida->saida("       $('#sc_btgp_btn_' + sGroup).removeClass('selected');\r\n");
  1839.            $nm_saida->saida("     }\r\n");
  1840.            $nm_saida->saida("   }\r\n");
  1841.            $nm_saida->saida("   </script> \r\n");
  1842.        } 
  1843.        if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['num_css']))
  1844.        {
  1845.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['num_css'] = rand(01000);
  1846.        }
  1847.        $write_css true;
  1848.        if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && !$this->Print_All && $this->NM_opcao != "print" && $this->NM_opcao != "pdf")
  1849.        {
  1850.            $write_css false;
  1851.        }
  1852.        if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_pdf']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_pdf'])
  1853.        {
  1854.            $write_css true;
  1855.        }
  1856.        if ($write_css) {$NM_css = @fopen($this->Ini->root $this->Ini->path_imag_temp '/sc_css_grid_new_grid_' $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['num_css'] . '.css''w');}
  1857.        if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1858.        {
  1859.            $this->NM_field_over  0;
  1860.            $this->NM_field_click 0;
  1861.            $Css_sub_cons = array();
  1862.            if (($this->NM_opcao == "print" && $GLOBALS['nmgp_cor_print'] == "PB") || ($this->NM_opcao == "pdf" &&  $GLOBALS['nmgp_tipo_pdf'] == "pb") || ($_SESSION['scriptcase']['contr_link_emb'] == "pdf" &&  $GLOBALS['nmgp_tipo_pdf'] == "pb")) 
  1863.            { 
  1864.                $NM_css_file $this->Ini->str_schema_all "_grid_bw.css";
  1865.                $NM_css_dir  $this->Ini->str_schema_all "_grid_bw" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
  1866.                if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css_bw'])) 
  1867.                { 
  1868.                    foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css_bw'] as $Apl => $Css_apl)
  1869.                    {
  1870.                        $Css_sub_cons[] = $Css_apl;
  1871.                        $Css_sub_cons[] = str_replace(".css"$_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css"$Css_apl);
  1872.                    }
  1873.                } 
  1874.            } 
  1875.            else 
  1876.            { 
  1877.                $NM_css_file $this->Ini->str_schema_all "_grid.css";
  1878.                $NM_css_dir  $this->Ini->str_schema_all "_grid" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
  1879.                if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css'])) 
  1880.                { 
  1881.                    foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css'] as $Apl => $Css_apl)
  1882.                    {
  1883.                        $Css_sub_cons[] = $Css_apl;
  1884.                        $Css_sub_cons[] = str_replace(".css"$_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css"$Css_apl);
  1885.                    }
  1886.                } 
  1887.            } 
  1888.            if (is_file($this->Ini->path_css $NM_css_file))
  1889.            {
  1890.                $NM_css_attr file($this->Ini->path_css $NM_css_file);
  1891.                foreach ($NM_css_attr as $NM_line_css)
  1892.                {
  1893.                    if (substr(trim($NM_line_css), 016) == ".scGridFieldOver" && strpos($NM_line_css"background-color:") !== false)
  1894.                    {
  1895.                        $this->NM_field_over 1;
  1896.                    }
  1897.                    if (substr(trim($NM_line_css), 017) == ".scGridFieldClick" && strpos($NM_line_css"background-color:") !== false)
  1898.                    {
  1899.                        $this->NM_field_click 1;
  1900.                    }
  1901.                    $NM_line_css str_replace("../../img"$this->Ini->path_imag_cab  $NM_line_css);
  1902.                    if ($write_css) {@fwrite($NM_css"    " .  $NM_line_css "\r\n");}
  1903.                }
  1904.            }
  1905.            if (is_file($this->Ini->path_css $NM_css_dir))
  1906.            {
  1907.                $NM_css_attr file($this->Ini->path_css $NM_css_dir);
  1908.                foreach ($NM_css_attr as $NM_line_css)
  1909.                {
  1910.                    if (substr(trim($NM_line_css), 016) == ".scGridFieldOver" && strpos($NM_line_css"background-color:") !== false)
  1911.                    {
  1912.                        $this->NM_field_over 1;
  1913.                    }
  1914.                    if (substr(trim($NM_line_css), 017) == ".scGridFieldClick" && strpos($NM_line_css"background-color:") !== false)
  1915.                    {
  1916.                        $this->NM_field_click 1;
  1917.                    }
  1918.                    $NM_line_css str_replace("../../img"$this->Ini->path_imag_cab  $NM_line_css);
  1919.                    if ($write_css) {@fwrite($NM_css"    " .  $NM_line_css "\r\n");}
  1920.                }
  1921.            }
  1922.            if (!empty($Css_sub_cons))
  1923.            {
  1924.                $Css_sub_cons array_unique($Css_sub_cons);
  1925.                foreach ($Css_sub_cons as $Cada_css_sub)
  1926.                {
  1927.                    if (is_file($this->Ini->path_css $Cada_css_sub))
  1928.                    {
  1929.                        $compl_css str_replace(".""_"$Cada_css_sub);
  1930.                        $temp_css  explode("/"$compl_css);
  1931.                        if (isset($temp_css[1])) { $compl_css $temp_css[1];}
  1932.                        $NM_css_attr file($this->Ini->path_css $Cada_css_sub);
  1933.                        foreach ($NM_css_attr as $NM_line_css)
  1934.                        {
  1935.                            $NM_line_css str_replace("../../img"$this->Ini->path_imag_cab  $NM_line_css);
  1936.                            if ($write_css) {@fwrite($NM_css"    ." .  $compl_css "_" substr(trim($NM_line_css), 1) . "\r\n");}
  1937.                        }
  1938.                    }
  1939.                }
  1940.            }
  1941.        }
  1942.        if ($write_css) {@fclose($NM_css);}
  1943.            $this->NM_css_val_embed .= "win";
  1944.            $this->NM_css_ajx_embed .= "ult_set";
  1945.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts)) 
  1946.  { 
  1947.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"" $this->Ini->str_google_fonts "\" />\r\n");
  1948.  } 
  1949.        if (!$write_css)
  1950.        {
  1951.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $this->Ini->str_schema_all "_grid.css\" type=\"text/css\" media=\"screen\" />\r\n");
  1952.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $this->Ini->str_schema_all "_grid" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" type=\"text/css\" media=\"screen\" />\r\n");
  1953.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $_SESSION['scriptcase']['erro']['str_schema'] . "\" type=\"text/css\" media=\"screen\" />\r\n");
  1954.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $_SESSION['scriptcase']['erro']['str_schema_dir'] . "\" type=\"text/css\" media=\"screen\" />\r\n");
  1955.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $this->Ini->str_schema_all "_tab.css\" type=\"text/css\" media=\"screen\" />\r\n");
  1956.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $this->Ini->str_schema_all "_tab" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" type=\"text/css\" media=\"screen\" />\r\n");
  1957.        }
  1958.        elseif ($this->NM_opcao == "print" || $this->Print_All)
  1959.        {
  1960.            $nm_saida->saida("  <style type=\"text/css\">\r\n");
  1961.            $NM_css file($this->Ini->root $this->Ini->path_imag_temp '/sc_css_grid_new_grid_' $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['num_css'] . '.css');
  1962.            foreach ($NM_css as $cada_css)
  1963.            {
  1964.               $nm_saida->saida("  " str_replace("\r\n"""$cada_css) . "\r\n");
  1965.            }
  1966.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $_SESSION['scriptcase']['erro']['str_schema'] . "\" type=\"text/css\" media=\"screen\" />\r\n");
  1967.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $_SESSION['scriptcase']['erro']['str_schema_dir'] . "\" type=\"text/css\" media=\"screen\" />\r\n");
  1968.            $nm_saida->saida("  </style>\r\n");
  1969.        }
  1970.        else
  1971.        {
  1972.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"" $this->Ini->path_imag_temp "/sc_css_grid_new_grid_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['num_css'] . ".css\" type=\"text/css\" media=\"screen\" />\r\n");
  1973.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $_SESSION['scriptcase']['erro']['str_schema'] . "\" type=\"text/css\" media=\"screen\" />\r\n");
  1974.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $_SESSION['scriptcase']['erro']['str_schema_dir'] . "\" type=\"text/css\" media=\"screen\" />\r\n");
  1975.        }
  1976.        $str_iframe_body = ($this->aba_iframe) ? 'marginwidth="0px" marginheight="0px" topmargin="0px" leftmargin="0px"' '';
  1977.        $nm_saida->saida("  <style type=\"text/css\">\r\n");
  1978.        $nm_saida->saida("  </style>\r\n");
  1979.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $this->Ini->str_schema_all "_btngrp.css\" type=\"text/css\" media=\"screen\" />\r\n");
  1980.            $nm_saida->saida("   <link rel=\"stylesheet\" href=\"../_lib/css/" $this->Ini->str_schema_all "_btngrp" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\" type=\"text/css\" media=\"screen\" />\r\n");
  1981.        if (!$write_css)
  1982.        {
  1983.            $nm_saida->saida("   <link rel=\"stylesheet\" type=\"text/css\" href=\"" $this->Ini->path_link "grid_new/grid_new_grid_" strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) . ".css\" />\r\n");
  1984.        }
  1985.        else
  1986.        {
  1987.            $nm_saida->saida("  <style type=\"text/css\">\r\n");
  1988.            $NM_css file($this->Ini->root $this->Ini->path_link "grid_new/grid_new_grid_" .strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) . ".css");
  1989.            foreach ($NM_css as $cada_css)
  1990.            {
  1991.               $nm_saida->saida("  " str_replace("\r\n"""$cada_css) . "\r\n");
  1992.            }
  1993.   if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert'])
  1994.   {
  1995.    $nm_saida->saida("      thead { display: table-header-group !important; }\r\n");
  1996.    $nm_saida->saida("      tfoot { display: table-row-group !important; }\r\n");
  1997.    $nm_saida->saida("      table td, table tr, td, tr, table { page-break-inside: avoid !important; }\r\n");
  1998.    $nm_saida->saida("      #summary_body > td { padding: 0px !important; }\r\n");
  1999.   }
  2000.            $nm_saida->saida("  </style>\r\n");
  2001.        }
  2002.        $nm_saida->saida("  </HEAD>\r\n");
  2003.    } 
  2004.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $this->Ini->nm_ger_css_emb)
  2005.    {
  2006.        $this->Ini->nm_ger_css_emb false;
  2007.            $nm_saida->saida("  <style type=\"text/css\">\r\n");
  2008.        $NM_css file($this->Ini->root $this->Ini->path_link "grid_new/grid_new_grid_" .strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) . ".css");
  2009.        foreach ($NM_css as $cada_css)
  2010.        {
  2011.            $cada_css ".grid_new_" substr($cada_css1);
  2012.               $nm_saida->saida("  " str_replace("\r\n"""$cada_css) . "\r\n");
  2013.        }
  2014.            $nm_saida->saida("  </style>\r\n");
  2015.    }
  2016.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2017.    { 
  2018.        if (!$this->Ini->Export_html_zip && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word'] && ($this->Print_All || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] == "print")) 
  2019.        {
  2020.            if ($this->Print_All
  2021.            {
  2022.                $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/buttons/" $this->Ini->Str_btn_css "\" /> \r\n");
  2023.            }
  2024.            $nm_saida->saida("  <body class=\"" $this->css_scGridPage "\" " $str_iframe_body " style=\"-webkit-print-color-adjust: exact;" $css_body "\">\r\n");
  2025.            $nm_saida->saida("   <TABLE id=\"sc_table_print\" cellspacing=0 cellpadding=0 align=\"center\" valign=\"top\" " $this->Tab_width ">\r\n");
  2026.            $nm_saida->saida("     <TR>\r\n");
  2027.            $nm_saida->saida("       <TD>\r\n");
  2028.            $Cod_Btn nmButtonOutput($this->arr_buttons"bprint""prit_web_page()""prit_web_page()""Bprint_print""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2029.            $nm_saida->saida("           $Cod_Btn \r\n");
  2030.            $nm_saida->saida("       </TD>\r\n");
  2031.            $nm_saida->saida("     </TR>\r\n");
  2032.            $nm_saida->saida("   </TABLE>\r\n");
  2033.            $nm_saida->saida("  <script type=\"text/javascript\" src=\"" $this->Ini->path_prod "/third/jquery/js/jquery.js\"></script>\r\n");
  2034.            $nm_saida->saida("  <script type=\"text/javascript\">\r\n");
  2035.            $nm_saida->saida("     $(\"#Bprint_print\").addClass(\"disabled\").prop(\"disabled\", true);\r\n");
  2036.            $nm_saida->saida("     $(function() {\r\n");
  2037.            $nm_saida->saida("         $(\"#Bprint_print\").removeClass(\"disabled\").prop(\"disabled\", false);\r\n");
  2038.            $nm_saida->saida("     });\r\n");
  2039.            $nm_saida->saida("     function prit_web_page()\r\n");
  2040.            $nm_saida->saida("     {\r\n");
  2041.            $nm_saida->saida("        if ($(\"#Bprint_print\").prop(\"disabled\")) {\r\n");
  2042.            $nm_saida->saida("            return;\r\n");
  2043.            $nm_saida->saida("        }\r\n");
  2044.            $nm_saida->saida("        document.getElementById('sc_table_print').style.display = 'none';\r\n");
  2045.            $nm_saida->saida("        var is_safari = navigator.userAgent.indexOf(\"Safari\") > -1;\r\n");
  2046.            $nm_saida->saida("        var is_chrome = navigator.userAgent.indexOf('Chrome') > -1\r\n");
  2047.            $nm_saida->saida("        if ((is_chrome) && (is_safari)) {is_safari=false;}\r\n");
  2048.            $nm_saida->saida("        window.print();\r\n");
  2049.            $nm_saida->saida("        if (is_safari) {setTimeout(\"window.close()\", 1000);} else {window.close();}\r\n");
  2050.            $nm_saida->saida("     }\r\n");
  2051.            $nm_saida->saida("  </script>\r\n");
  2052.        }
  2053.        else
  2054.        {
  2055.           $remove_margin = isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['remove_margin']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['remove_margin'] ? 'margin: 0; ' '';
  2056.            $nm_saida->saida("  <body class=\"" $this->css_scGridPage "\" " $str_iframe_body " style=\"" $remove_margin$css_body "\">\r\n");
  2057.        }
  2058.        $nm_saida->saida("  " $this->Ini->Ajax_result_set "\r\n");
  2059.        if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && !$this->Print_All)
  2060.        { 
  2061.            $Cod_Btn nmButtonOutput($this->arr_buttons"berrm_clse""nmAjaxHideDebug()""nmAjaxHideDebug()"""""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2062.            $nm_saida->saida("<div id=\"id_debug_window\" style=\"display: none; position: absolute; left: 50px; top: 50px\"><table class=\"scFormMessageTable\">\r\n");
  2063.            $nm_saida->saida("<tr><td class=\"scFormMessageTitle\">" $Cod_Btn "&nbsp;&nbsp;Output</td></tr>\r\n");
  2064.            $nm_saida->saida("<tr><td class=\"scFormMessageMessage\" style=\"padding: 0px; vertical-align: top\"><div style=\"padding: 2px; height: 200px; width: 350px; overflow: auto\" id=\"id_debug_text\"></div></td></tr>\r\n");
  2065.            $nm_saida->saida("</table></div>\r\n");
  2066.        } 
  2067.        if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" && !$this->Print_All)
  2068.        { 
  2069.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total")
  2070.            {
  2071.            $nm_saida->saida("          <div style=\"height:1px;overflow:hidden\"><H1 style=\"font-size:0;padding:1px\"></H1></div>\r\n");
  2072.            }
  2073.        } 
  2074.        $this->Tab_align  "center";
  2075.        $this->Tab_valign "top";
  2076.        $this->Tab_width "";
  2077.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_res'])
  2078.        {
  2079.            return;
  2080.        } 
  2081.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2082.        { 
  2083.            $this->form_navegacao();
  2084.            if ($NM_run_iframe != 1) {$this->check_btns();}
  2085.        } 
  2086.        $nm_saida->saida("   <TABLE id=\"main_table_grid\" cellspacing=0 cellpadding=0 align=\"" $this->Tab_align "\" valign=\"" $this->Tab_valign "\" " $this->Tab_width ">\r\n");
  2087.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert'])
  2088.    {
  2089.    }
  2090.    else
  2091.    {
  2092.        $nm_saida->saida("     <TR>\r\n");
  2093.        $nm_saida->saida("       <TD>\r\n");
  2094.        $nm_saida->saida("       <div class=\"scGridBorder\">\r\n");
  2095.        if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word'])
  2096.        { 
  2097.            $nm_saida->saida("  <div id=\"id_div_process\" style=\"display: none; margin: 10px; whitespace: nowrap\" class=\"scFormProcessFixed\"><span class=\"scFormProcess\"><img border=\"0\" src=\"" $this->Ini->path_icones "/scriptcase__NM__ajax_load.gif\" align=\"absmiddle\" />&nbsp;" $this->Ini->Nm_lang['lang_othr_prcs'] . "...</span></div>\r\n");
  2098.            $nm_saida->saida("  <div id=\"id_div_process_block\" style=\"display: none; margin: 10px; whitespace: nowrap\"><span class=\"scFormProcess\"><img border=\"0\" src=\"" $this->Ini->path_icones "/scriptcase__NM__ajax_load.gif\" align=\"absmiddle\" />&nbsp;" $this->Ini->Nm_lang['lang_othr_prcs'] . "...</span></div>\r\n");
  2099.            $nm_saida->saida("  <div id=\"id_fatal_error\" class=\"" $this->css_scGridLabel "\" style=\"display: none; position: absolute\"></div>\r\n");
  2100.        } 
  2101.        $nm_saida->saida("       <TABLE width='100%' cellspacing=0 cellpadding=0>\r\n");
  2102.    }
  2103.    }  
  2104.  }  
  2105.  function NM_cor_embutida()
  2106.  {  
  2107.    $compl_css "";
  2108.    include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  2109.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2110.    {
  2111.        $this->NM_css_val_embed "sznmxizkjnvl";
  2112.        $this->NM_css_ajx_embed "Ajax_res";
  2113.    }
  2114.    elseif ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_herda_css'] == "N")
  2115.    {
  2116.        if (($this->NM_opcao == "print" && $GLOBALS['nmgp_cor_print'] == "PB") || ($this->NM_opcao == "pdf" &&  $GLOBALS['nmgp_tipo_pdf'] == "pb") || ($_SESSION['scriptcase']['contr_link_emb'] == "pdf" &&  $GLOBALS['nmgp_tipo_pdf'] == "pb")) 
  2117.        { 
  2118.            if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css_bw']['grid_new']))
  2119.            {
  2120.                $compl_css str_replace(".""_"$_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css_bw']['grid_new']) . "_";
  2121.            } 
  2122.        } 
  2123.        else 
  2124.        { 
  2125.            if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css']['grid_new']))
  2126.            {
  2127.                $compl_css str_replace(".""_"$_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css']['grid_new']) . "_";
  2128.            } 
  2129.        }
  2130.    }
  2131.    $temp_css  explode("/"$compl_css);
  2132.    if (isset($temp_css[1])) { $compl_css $temp_css[1];}
  2133.    $this->css_scGridPage           $compl_css "scGridPage";
  2134.    $this->css_scGridPageLink       $compl_css "scGridPageLink";
  2135.    $this->css_scGridToolbar        $compl_css "scGridToolbar";
  2136.    $this->css_scGridToolbarPadd    $compl_css "scGridToolbarPadding";
  2137.    $this->css_css_toolbar_obj      $compl_css "css_toolbar_obj";
  2138.    $this->css_scGridHeader         $compl_css "scGridHeader";
  2139.    $this->css_scGridHeaderFont     $compl_css "scGridHeaderFont";
  2140.    $this->css_scGridFooter         $compl_css "scGridFooter";
  2141.    $this->css_scGridFooterFont     $compl_css "scGridFooterFont";
  2142.    $this->css_scGridBlock          $compl_css "scGridBlock";
  2143.    $this->css_scGridBlockFont      $compl_css "scGridBlockFont";
  2144.    $this->css_scGridBlockAlign     $compl_css "scGridBlockAlign";
  2145.    $this->css_scGridTotal          $compl_css "scGridTotal";
  2146.    $this->css_scGridTotalFont      $compl_css "scGridTotalFont";
  2147.    $this->css_scGridSubtotal       $compl_css "scGridSubtotal";
  2148.    $this->css_scGridSubtotalFont   $compl_css "scGridSubtotalFont";
  2149.    $this->css_scGridFieldEven      $compl_css "scGridFieldEven";
  2150.    $this->css_scGridFieldEvenFont  $compl_css "scGridFieldEvenFont";
  2151.    $this->css_scGridFieldEvenVert  $compl_css "scGridFieldEvenVert";
  2152.    $this->css_scGridFieldEvenLink  $compl_css "scGridFieldEvenLink";
  2153.    $this->css_scGridFieldOdd       $compl_css "scGridFieldOdd";
  2154.    $this->css_scGridFieldOddFont   $compl_css "scGridFieldOddFont";
  2155.    $this->css_scGridFieldOddVert   $compl_css "scGridFieldOddVert";
  2156.    $this->css_scGridFieldOddLink   $compl_css "scGridFieldOddLink";
  2157.    $this->css_scGridFieldClick     $compl_css "scGridFieldClick";
  2158.    $this->css_scGridFieldOver      $compl_css "scGridFieldOver";
  2159.    $this->css_scGridLabel          $compl_css "scGridLabel";
  2160.    $this->css_scGridLabelVert      $compl_css "scGridLabelVert";
  2161.    $this->css_scGridLabelFont      $compl_css "scGridLabelFont";
  2162.    $this->css_scGridLabelLink      $compl_css "scGridLabelLink";
  2163.    $this->css_scGridTabela         $compl_css "scGridTabela";
  2164.    $this->css_scGridTabelaTd       $compl_css "scGridTabelaTd";
  2165.    $this->css_scGridBlockBg        $compl_css "scGridBlockBg";
  2166.    $this->css_scGridBlockLineBg    $compl_css "scGridBlockLineBg";
  2167.    $this->css_scGridBlockSpaceBg   $compl_css "scGridBlockSpaceBg";
  2168.    $this->css_scGridLabelNowrap    "";
  2169.    $this->css_scAppDivMoldura      $compl_css "scAppDivMoldura";
  2170.    $this->css_scAppDivHeader       $compl_css "scAppDivHeader";
  2171.    $this->css_scAppDivHeaderText   $compl_css "scAppDivHeaderText";
  2172.    $this->css_scAppDivContent      $compl_css "scAppDivContent";
  2173.    $this->css_scAppDivContentText  $compl_css "scAppDivContentText";
  2174.    $this->css_scAppDivToolbar      $compl_css "scAppDivToolbar";
  2175.    $this->css_scAppDivToolbarInput $compl_css "scAppDivToolbarInput";

  2176.    $compl_css_emb = ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida']) ? "grid_new_" "";
  2177.    $this->css_sep " ";
  2178.    $this->css_proprietarios_idproprietario_label $compl_css_emb "css_proprietarios_idproprietario_label";
  2179.    $this->css_proprietarios_idproprietario_grid_line $compl_css_emb "css_proprietarios_idproprietario_grid_line";
  2180.    $this->css_proprietarios_nome_label $compl_css_emb "css_proprietarios_nome_label";
  2181.    $this->css_proprietarios_nome_grid_line $compl_css_emb "css_proprietarios_nome_grid_line";
  2182.    $this->css_proprietarios_sexo_label $compl_css_emb "css_proprietarios_sexo_label";
  2183.    $this->css_proprietarios_sexo_grid_line $compl_css_emb "css_proprietarios_sexo_grid_line";
  2184.    $this->css_proprietarios_cpf_label $compl_css_emb "css_proprietarios_cpf_label";
  2185.    $this->css_proprietarios_cpf_grid_line $compl_css_emb "css_proprietarios_cpf_grid_line";
  2186.    $this->css_proprietarios_telefone_label $compl_css_emb "css_proprietarios_telefone_label";
  2187.    $this->css_proprietarios_telefone_grid_line $compl_css_emb "css_proprietarios_telefone_grid_line";
  2188.    $this->css_veiculos_idveiculos_label $compl_css_emb "css_veiculos_idveiculos_label";
  2189.    $this->css_veiculos_idveiculos_grid_line $compl_css_emb "css_veiculos_idveiculos_grid_line";
  2190.    $this->css_veiculos_anomodelo_label $compl_css_emb "css_veiculos_anomodelo_label";
  2191.    $this->css_veiculos_anomodelo_grid_line $compl_css_emb "css_veiculos_anomodelo_grid_line";
  2192.    $this->css_veiculos_placa_label $compl_css_emb "css_veiculos_placa_label";
  2193.    $this->css_veiculos_placa_grid_line $compl_css_emb "css_veiculos_placa_grid_line";
  2194.    $this->css_proprietarios_endereco_label $compl_css_emb "css_proprietarios_endereco_label";
  2195.    $this->css_proprietarios_endereco_grid_line $compl_css_emb "css_proprietarios_endereco_grid_line";
  2196.  }  
  2197.  function cabecalho()
  2198.  {
  2199.      if($_SESSION['scriptcase']['proc_mobile'] && method_exists($this'cabecalho_mobile'))
  2200.      {
  2201.          $this->cabecalho_mobile();
  2202.      }
  2203.      else if(method_exists($this'cabecalho_normal'))
  2204.      {
  2205.          $this->cabecalho_normal();
  2206.      }
  2207.  }
  2208. // 
  2209. //----- 
  2210.  function cabecalho_normal()
  2211.  {
  2212.    global
  2213.           $nm_saida;
  2214.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['under_dashboard'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['compact_mode'] && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['maximized'])
  2215.    {
  2216.        return; 
  2217.    }
  2218.    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['cab']))
  2219.    {
  2220.        return; 
  2221.    }
  2222.    $nm_cab_filtro   ""
  2223.    $nm_cab_filtrobr ""
  2224.    $Str_date strtolower($_SESSION['scriptcase']['reg_conf']['date_format']);
  2225.    $Lim   strlen($Str_date);
  2226.    $Ult   "";
  2227.    $Arr_D = array();
  2228.    for ($I 0$I $Lim$I++)
  2229.    {
  2230.        $Char substr($Str_date$I1);
  2231.        if ($Char != $Ult)
  2232.        {
  2233.            $Arr_D[] = $Char;
  2234.        }
  2235.        $Ult $Char;
  2236.    }
  2237.    $Prim true;
  2238.    $Str  "";
  2239.    foreach ($Arr_D as $Cada_d)
  2240.    {
  2241.        $Str .= (!$Prim) ? $_SESSION['scriptcase']['reg_conf']['date_sep'] : "";
  2242.        $Str .= $Cada_d;
  2243.        $Prim false;
  2244.    }
  2245.    $Str str_replace("a""Y"$Str);
  2246.    $Str str_replace("y""Y"$Str);
  2247.    $nm_data_fixa date($Str); 
  2248.    $this->sc_proc_grid false
  2249.    $HTTP_REFERER = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ""
  2250.    $this->sc_where_orig   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  2251.    $this->sc_where_atual  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  2252.    $this->sc_where_filtro $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'];
  2253.    if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq']))
  2254.    {  
  2255.        $pos       0;
  2256.        $trab_pos  false;
  2257.        $pos_tmp   true
  2258.        $tmp       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'];
  2259.        while ($pos_tmp)
  2260.        {
  2261.           $pos strpos($tmp"##*@@"$pos);
  2262.           if ($pos !== false)
  2263.           {
  2264.               $trab_pos $pos;
  2265.               $pos += 4;
  2266.           }
  2267.           else
  2268.           {
  2269.               $pos_tmp false;
  2270.           }
  2271.        }
  2272.        $nm_cond_filtro_or  = (substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'], $trab_pos 5) == "or")  ? " " trim($this->Ini->Nm_lang['lang_srch_orr_cond']) . " " "";
  2273.        $nm_cond_filtro_and = (substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'], $trab_pos 5) == "and") ? " " trim($this->Ini->Nm_lang['lang_srch_and_cond']) . " " "";
  2274.        $nm_cab_filtro   substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'], 0$trab_pos);
  2275.        $nm_cab_filtrobr str_replace("##*@@"", " $nm_cond_filtro_or $nm_cond_filtro_and "<br />"$nm_cab_filtro);
  2276.        $pos       0;
  2277.        $trab_pos  false;
  2278.        $pos_tmp   true
  2279.        $tmp       $nm_cab_filtro;
  2280.        while ($pos_tmp)
  2281.        {
  2282.           $pos strpos($tmp"##*@@"$pos);
  2283.           if ($pos !== false)
  2284.           {
  2285.               $trab_pos $pos;
  2286.               $pos += 4;
  2287.           }
  2288.           else
  2289.           {
  2290.               $pos_tmp false;
  2291.           }
  2292.        }
  2293.        if ($trab_pos === false)
  2294.        {
  2295.        }
  2296.        else  
  2297.        {  
  2298.           $nm_cab_filtro substr($nm_cab_filtro0$trab_pos) . " " .  $nm_cond_filtro_or $nm_cond_filtro_and substr($nm_cab_filtro$trab_pos 5);
  2299.           $nm_cab_filtro str_replace("##*@@"", " $nm_cond_filtro_or $nm_cond_filtro_and$nm_cab_filtro);
  2300.        }   
  2301.    }   
  2302.    $this->nm_data->SetaData(date("Y/m/d H:i:s"), "YYYY/MM/DD HH:II:SS"); 
  2303.    $nm_saida->saida(" <TR id=\"sc_grid_head\">\r\n");
  2304.    if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sv_dt_head']))
  2305.    { 
  2306.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sv_dt_head'] = array();
  2307.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sv_dt_head']['fix'] = $nm_data_fixa;
  2308.        $nm_refresch_cab_rod true;
  2309.    } 
  2310.    else 
  2311.    { 
  2312.        $nm_refresch_cab_rod false;
  2313.    } 
  2314.    foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sv_dt_head'] as $ind => $val)
  2315.    {
  2316.        $tmp_var "sc_data_cab" $ind;
  2317.        if ($$tmp_var != $val)
  2318.        {
  2319.            $nm_refresch_cab_rod true;
  2320.            break;
  2321.        }
  2322.    }
  2323.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sv_dt_head']['fix'] != $nm_data_fixa)
  2324.    {
  2325.        $nm_refresch_cab_rod true;
  2326.    }
  2327.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'] && $nm_refresch_cab_rod)
  2328.    { 
  2329.        $_SESSION['scriptcase']['saida_html'] = "";
  2330.    } 
  2331.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sv_dt_head']['fix'] = $nm_data_fixa;
  2332.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf")
  2333.    { 
  2334.        $nm_saida->saida("  <TD class=\"" $this->css_scGridTabelaTd "\" style=\"vertical-align: top\">\r\n");
  2335.    } 
  2336.    else 
  2337.    { 
  2338.      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf']) 
  2339.      { 
  2340.          $this->NM_calc_span();
  2341.            $nm_saida->saida("   <TD colspan=\"" $this->NM_colspan "\" class=\"" $this->css_scGridTabelaTd "\" style=\"vertical-align: top\">\r\n");
  2342.      } 
  2343.      else if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert']) 
  2344.      {
  2345.          if($this->Tem_tab_vert)
  2346.          {
  2347.            $nm_saida->saida("   <TD colspan=\"2\" class=\"" $this->css_scGridTabelaTd "\" style=\"vertical-align: top\">\r\n");
  2348.          }
  2349.          else{
  2350.            $nm_saida->saida("   <TD class=\"" $this->css_scGridTabelaTd "\" style=\"vertical-align: top\">\r\n");
  2351.          }
  2352.      }
  2353.      else{
  2354.            $nm_saida->saida("  <TD class=\"" $this->css_scGridTabelaTd "\" style=\"vertical-align: top\">\r\n");
  2355.      }
  2356.    } 
  2357.    $nm_saida->saida("<style>\r\n");
  2358.    $nm_saida->saida("    .scMenuTHeaderFont img, .scGridHeaderFont img , .scFormHeaderFont img , .scTabHeaderFont img , .scContainerHeaderFont img , .scFilterHeaderFont img { height:23px;}\r\n");
  2359.    $nm_saida->saida("</style>\r\n");
  2360.    $nm_saida->saida("<div class=\"" $this->css_scGridHeader "\" style=\"height: 54px; padding: 17px 15px; box-sizing: border-box;margin: -1px 0px 0px 0px;width: 100%;\">\r\n");
  2361.    $nm_saida->saida("    <div class=\"" $this->css_scGridHeaderFont "\" style=\"float: left; text-transform: uppercase;\">" $this->Ini->Nm_lang['lang_othr_grid_title'] . " </div>\r\n");
  2362.    $nm_saida->saida("    <div class=\"" $this->css_scGridHeaderFont "\" style=\"float: right;\">" $nm_data_fixa "</div>\r\n");
  2363.    $nm_saida->saida("</div>\r\n");
  2364.    $nm_saida->saida("  </TD>\r\n");
  2365.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'] && $nm_refresch_cab_rod)
  2366.    { 
  2367.        $this->Ini->Arr_result['setValue'][] = array('field' => 'sc_grid_head''value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
  2368.        $_SESSION['scriptcase']['saida_html'] = "";
  2369.    } 
  2370.    $nm_saida->saida(" </TR>\r\n");
  2371.  }
  2372. // 
  2373.  function label_grid($linhas 0)
  2374.  {
  2375.    global 
  2376.            $nm_saida;
  2377.    static $nm_seq_titulos   0
  2378.    $contr_embutida false;
  2379.    $salva_htm_emb  "";
  2380.    if ($linhas)
  2381.    {
  2382.       $this->Lin_impressas++;
  2383.    }
  2384.    $nm_seq_titulos++; 
  2385.    $tmp_header_row $nm_seq_titulos;
  2386.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['exibe_titulos'] != "S")
  2387.    { 
  2388.    } 
  2389.    else 
  2390.    { 
  2391.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_label'])
  2392.       { 
  2393.           if (!isset($_SESSION['scriptcase']['saida_var']) || !$_SESSION['scriptcase']['saida_var']) 
  2394.           { 
  2395.               $_SESSION['scriptcase']['saida_var']  = true;
  2396.               $_SESSION['scriptcase']['saida_html'] = "";
  2397.               $contr_embutida true;
  2398.           } 
  2399.           else 
  2400.           { 
  2401.               $salva_htm_emb $_SESSION['scriptcase']['saida_html'];
  2402.               $_SESSION['scriptcase']['saida_html'] = "";
  2403.           } 
  2404.       } 
  2405.    $nm_saida->saida("    <TR id=\"tit_grid_new__SCCS__" $nm_seq_titulos "\" align=\"center\" class=\"" $this->css_scGridLabel " sc-ui-grid-header-row sc-ui-grid-header-row-grid_new-" $tmp_header_row "\">\r\n");
  2406.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_label']) { 
  2407.    $nm_saida->saida("     <TD class=\"" $this->css_scGridBlockBg "\" style=\"width: " $this->width_tabula_quebra "; display:" $this->width_tabula_display ";\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_proprietarios_endereco_label'] . "\" >&nbsp;</TD>\r\n");
  2408.    } 
  2409.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq']) { 
  2410.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_proprietarios_endereco_label'] . "\" >&nbsp;</TD>\r\n");
  2411.    } 
  2412.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf") { 
  2413.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_proprietarios_endereco_label'] . "\" >&nbsp;</TD>\r\n");
  2414.    } 
  2415.    foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_label)
  2416.    { 
  2417.        $NM_func_lab "NM_label_" $Cada_label;
  2418.        $this->$NM_func_lab();
  2419.    } 
  2420.    $nm_saida->saida("</TR>\r\n");
  2421.      if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_label'])
  2422.      { 
  2423.          if (isset($_SESSION['scriptcase']['saida_var']) && $_SESSION['scriptcase']['saida_var'])
  2424.          { 
  2425.              $Cod_Html $_SESSION['scriptcase']['saida_html'];
  2426.              $pos_tag strpos($Cod_Html"<TD ");
  2427.              $Cod_Html substr($Cod_Html$pos_tag);
  2428.              $pos      0;
  2429.              $pos_tag  false;
  2430.              $pos_tmp  true
  2431.              $tmp      $Cod_Html;
  2432.              while ($pos_tmp)
  2433.              {
  2434.                 $pos strpos($tmp"</TR>"$pos);
  2435.                 if ($pos !== false)
  2436.                 {
  2437.                     $pos_tag $pos;
  2438.                     $pos += 4;
  2439.                 }
  2440.                 else
  2441.                 {
  2442.                     $pos_tmp false;
  2443.                 }
  2444.              }
  2445.              $Cod_Html substr($Cod_Html0$pos_tag);
  2446.              $Nm_temp explode("</TD>"$Cod_Html);
  2447.              $css_emb "<style type=\"text/css\">";
  2448.              $NM_css file($this->Ini->root $this->Ini->path_link "grid_new/grid_new_grid_" .strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) . ".css");
  2449.              foreach ($NM_css as $cada_css)
  2450.              {
  2451.                  $css_emb .= ".grid_new_" substr($cada_css1);
  2452.              }
  2453.              $css_emb .= "</style>";
  2454.              $Cod_Html $css_emb $Cod_Html;
  2455.              $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cols_emb'] = count($Nm_temp) - 1;
  2456.              if ($contr_embutida
  2457.              { 
  2458.                  $_SESSION['scriptcase']['saida_var']  = false;
  2459.                  $nm_saida->saida($Cod_Html);
  2460.              } 
  2461.              else 
  2462.              { 
  2463.                  $_SESSION['scriptcase']['saida_html'] = $salva_htm_emb $Cod_Html;
  2464.              } 
  2465.          } 
  2466.      } 
  2467.      $NM_seq_lab 1;
  2468.      foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels'] as $NM_cmp => $NM_lab)
  2469.      {
  2470.          if (empty($NM_lab) || $NM_lab == "&nbsp;")
  2471.          {
  2472.              $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels'][$NM_cmp] = "No_Label" $NM_seq_lab;
  2473.              $NM_seq_lab++;
  2474.          }
  2475.      } 
  2476.    } 
  2477.  }
  2478.  function NM_label_proprietarios_idproprietario()
  2479.  {
  2480.    global $nm_saida;
  2481.    $SC_Label = (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario"
  2482.    if (!isset($this->NM_cmp_hidden['proprietarios_idproprietario']) || $this->NM_cmp_hidden['proprietarios_idproprietario'] != "off") { 
  2483.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont $this->css_sep $this->css_proprietarios_idproprietario_label "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_proprietarios_idproprietario_label'] . "\" >\r\n");
  2484.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf")
  2485.    {
  2486.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  2487.       {
  2488.           $NM_cmp_class =  "Proprietarios.idProprietario";
  2489.       }
  2490.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  2491.       {
  2492.           $NM_cmp_class =  "Proprietarios.idProprietario";
  2493.       }
  2494.       else
  2495.       {
  2496.           $NM_cmp_class =  "proprietarios_idproprietario";
  2497.       }
  2498.       $link_img "";
  2499.       $nome_img $this->Ini->Label_sort;
  2500.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_cmp'] == $NM_cmp_class)
  2501.       {
  2502.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_label'] == "desc")
  2503.           {
  2504.               $nome_img $this->Ini->Label_sort_desc;
  2505.           }
  2506.           else
  2507.           {
  2508.               $nome_img $this->Ini->Label_sort_asc;
  2509.           }
  2510.       }
  2511.       if (empty($this->Ini->Label_sort_pos) || $this->Ini->Label_sort_pos == "right")
  2512.       {
  2513.           $this->Ini->Label_sort_pos "right_field";
  2514.       }
  2515.       $Css_compl_sort " style=\"display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;justify-content:inherit;\"";
  2516.       if (empty($nome_img))
  2517.       {
  2518.           $link_img nl2br($SC_Label);
  2519.           $Css_compl_sort "";
  2520.       }
  2521.       elseif ($this->Ini->Label_sort_pos == "right_field")
  2522.       {
  2523.           $link_img "<span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2524.       }
  2525.       elseif ($this->Ini->Label_sort_pos == "left_field")
  2526.       {
  2527.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2528.       }
  2529.       elseif ($this->Ini->Label_sort_pos == "right_cell")
  2530.       {
  2531.           $link_img "<span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2532.       }
  2533.       elseif ($this->Ini->Label_sort_pos == "left_cell")
  2534.       {
  2535.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2536.       }
  2537.    $nm_saida->saida("<a href=\"javascript:nm_gp_submit2('" $NM_cmp_class "')\" class=\"" $this->css_scGridLabelLink "\"" $Css_compl_sort ">" $link_img "</a>\r\n");
  2538.    }
  2539.    else
  2540.    {
  2541.    $nm_saida->saida("" nl2br($SC_Label) . "\r\n");
  2542.    }
  2543.    $nm_saida->saida("</TD>\r\n");
  2544.    } 
  2545.  }
  2546.  function NM_label_proprietarios_nome()
  2547.  {
  2548.    global $nm_saida;
  2549.    $SC_Label = (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome"
  2550.    if (!isset($this->NM_cmp_hidden['proprietarios_nome']) || $this->NM_cmp_hidden['proprietarios_nome'] != "off") { 
  2551.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont $this->css_sep $this->css_proprietarios_nome_label "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_proprietarios_nome_label'] . "\" >\r\n");
  2552.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf")
  2553.    {
  2554.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  2555.       {
  2556.           $NM_cmp_class =  "Proprietarios.Nome";
  2557.       }
  2558.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  2559.       {
  2560.           $NM_cmp_class =  "Proprietarios.Nome";
  2561.       }
  2562.       else
  2563.       {
  2564.           $NM_cmp_class =  "proprietarios_nome";
  2565.       }
  2566.       $link_img "";
  2567.       $nome_img $this->Ini->Label_sort;
  2568.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_cmp'] == $NM_cmp_class)
  2569.       {
  2570.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_label'] == "desc")
  2571.           {
  2572.               $nome_img $this->Ini->Label_sort_desc;
  2573.           }
  2574.           else
  2575.           {
  2576.               $nome_img $this->Ini->Label_sort_asc;
  2577.           }
  2578.       }
  2579.       if (empty($this->Ini->Label_sort_pos) || $this->Ini->Label_sort_pos == "right")
  2580.       {
  2581.           $this->Ini->Label_sort_pos "right_field";
  2582.       }
  2583.       $Css_compl_sort " style=\"display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;justify-content:inherit;\"";
  2584.       if (empty($nome_img))
  2585.       {
  2586.           $link_img nl2br($SC_Label);
  2587.           $Css_compl_sort "";
  2588.       }
  2589.       elseif ($this->Ini->Label_sort_pos == "right_field")
  2590.       {
  2591.           $link_img "<span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2592.       }
  2593.       elseif ($this->Ini->Label_sort_pos == "left_field")
  2594.       {
  2595.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2596.       }
  2597.       elseif ($this->Ini->Label_sort_pos == "right_cell")
  2598.       {
  2599.           $link_img "<span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2600.       }
  2601.       elseif ($this->Ini->Label_sort_pos == "left_cell")
  2602.       {
  2603.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2604.       }
  2605.    $nm_saida->saida("<a href=\"javascript:nm_gp_submit2('" $NM_cmp_class "')\" class=\"" $this->css_scGridLabelLink "\"" $Css_compl_sort ">" $link_img "</a>\r\n");
  2606.    }
  2607.    else
  2608.    {
  2609.    $nm_saida->saida("" nl2br($SC_Label) . "\r\n");
  2610.    }
  2611.    $nm_saida->saida("</TD>\r\n");
  2612.    } 
  2613.  }
  2614.  function NM_label_proprietarios_sexo()
  2615.  {
  2616.    global $nm_saida;
  2617.    $SC_Label = (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo"
  2618.    if (!isset($this->NM_cmp_hidden['proprietarios_sexo']) || $this->NM_cmp_hidden['proprietarios_sexo'] != "off") { 
  2619.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont $this->css_sep $this->css_proprietarios_sexo_label "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_proprietarios_sexo_label'] . "\" >\r\n");
  2620.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf")
  2621.    {
  2622.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  2623.       {
  2624.           $NM_cmp_class =  "Proprietarios.Sexo";
  2625.       }
  2626.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  2627.       {
  2628.           $NM_cmp_class =  "Proprietarios.Sexo";
  2629.       }
  2630.       else
  2631.       {
  2632.           $NM_cmp_class =  "proprietarios_sexo";
  2633.       }
  2634.       $link_img "";
  2635.       $nome_img $this->Ini->Label_sort;
  2636.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_cmp'] == $NM_cmp_class)
  2637.       {
  2638.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_label'] == "desc")
  2639.           {
  2640.               $nome_img $this->Ini->Label_sort_desc;
  2641.           }
  2642.           else
  2643.           {
  2644.               $nome_img $this->Ini->Label_sort_asc;
  2645.           }
  2646.       }
  2647.       if (empty($this->Ini->Label_sort_pos) || $this->Ini->Label_sort_pos == "right")
  2648.       {
  2649.           $this->Ini->Label_sort_pos "right_field";
  2650.       }
  2651.       $Css_compl_sort " style=\"display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;justify-content:inherit;\"";
  2652.       if (empty($nome_img))
  2653.       {
  2654.           $link_img nl2br($SC_Label);
  2655.           $Css_compl_sort "";
  2656.       }
  2657.       elseif ($this->Ini->Label_sort_pos == "right_field")
  2658.       {
  2659.           $link_img "<span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2660.       }
  2661.       elseif ($this->Ini->Label_sort_pos == "left_field")
  2662.       {
  2663.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2664.       }
  2665.       elseif ($this->Ini->Label_sort_pos == "right_cell")
  2666.       {
  2667.           $link_img "<span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2668.       }
  2669.       elseif ($this->Ini->Label_sort_pos == "left_cell")
  2670.       {
  2671.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2672.       }
  2673.    $nm_saida->saida("<a href=\"javascript:nm_gp_submit2('" $NM_cmp_class "')\" class=\"" $this->css_scGridLabelLink "\"" $Css_compl_sort ">" $link_img "</a>\r\n");
  2674.    }
  2675.    else
  2676.    {
  2677.    $nm_saida->saida("" nl2br($SC_Label) . "\r\n");
  2678.    }
  2679.    $nm_saida->saida("</TD>\r\n");
  2680.    } 
  2681.  }
  2682.  function NM_label_proprietarios_cpf()
  2683.  {
  2684.    global $nm_saida;
  2685.    $SC_Label = (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf"
  2686.    if (!isset($this->NM_cmp_hidden['proprietarios_cpf']) || $this->NM_cmp_hidden['proprietarios_cpf'] != "off") { 
  2687.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont $this->css_sep $this->css_proprietarios_cpf_label "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_proprietarios_cpf_label'] . "\" >\r\n");
  2688.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf")
  2689.    {
  2690.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  2691.       {
  2692.           $NM_cmp_class =  "Proprietarios.Cpf";
  2693.       }
  2694.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  2695.       {
  2696.           $NM_cmp_class =  "Proprietarios.Cpf";
  2697.       }
  2698.       else
  2699.       {
  2700.           $NM_cmp_class =  "proprietarios_cpf";
  2701.       }
  2702.       $link_img "";
  2703.       $nome_img $this->Ini->Label_sort;
  2704.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_cmp'] == $NM_cmp_class)
  2705.       {
  2706.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_label'] == "desc")
  2707.           {
  2708.               $nome_img $this->Ini->Label_sort_desc;
  2709.           }
  2710.           else
  2711.           {
  2712.               $nome_img $this->Ini->Label_sort_asc;
  2713.           }
  2714.       }
  2715.       if (empty($this->Ini->Label_sort_pos) || $this->Ini->Label_sort_pos == "right")
  2716.       {
  2717.           $this->Ini->Label_sort_pos "right_field";
  2718.       }
  2719.       $Css_compl_sort " style=\"display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;justify-content:inherit;\"";
  2720.       if (empty($nome_img))
  2721.       {
  2722.           $link_img nl2br($SC_Label);
  2723.           $Css_compl_sort "";
  2724.       }
  2725.       elseif ($this->Ini->Label_sort_pos == "right_field")
  2726.       {
  2727.           $link_img "<span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2728.       }
  2729.       elseif ($this->Ini->Label_sort_pos == "left_field")
  2730.       {
  2731.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2732.       }
  2733.       elseif ($this->Ini->Label_sort_pos == "right_cell")
  2734.       {
  2735.           $link_img "<span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2736.       }
  2737.       elseif ($this->Ini->Label_sort_pos == "left_cell")
  2738.       {
  2739.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2740.       }
  2741.    $nm_saida->saida("<a href=\"javascript:nm_gp_submit2('" $NM_cmp_class "')\" class=\"" $this->css_scGridLabelLink "\"" $Css_compl_sort ">" $link_img "</a>\r\n");
  2742.    }
  2743.    else
  2744.    {
  2745.    $nm_saida->saida("" nl2br($SC_Label) . "\r\n");
  2746.    }
  2747.    $nm_saida->saida("</TD>\r\n");
  2748.    } 
  2749.  }
  2750.  function NM_label_proprietarios_telefone()
  2751.  {
  2752.    global $nm_saida;
  2753.    $SC_Label = (isset($this->New_label['proprietarios_telefone'])) ? $this->New_label['proprietarios_telefone'] : "Telefone"
  2754.    if (!isset($this->NM_cmp_hidden['proprietarios_telefone']) || $this->NM_cmp_hidden['proprietarios_telefone'] != "off") { 
  2755.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont $this->css_sep $this->css_proprietarios_telefone_label "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_proprietarios_telefone_label'] . "\" >\r\n");
  2756.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf")
  2757.    {
  2758.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  2759.       {
  2760.           $NM_cmp_class =  "Proprietarios.Telefone";
  2761.       }
  2762.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  2763.       {
  2764.           $NM_cmp_class =  "Proprietarios.Telefone";
  2765.       }
  2766.       else
  2767.       {
  2768.           $NM_cmp_class =  "proprietarios_telefone";
  2769.       }
  2770.       $link_img "";
  2771.       $nome_img $this->Ini->Label_sort;
  2772.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_cmp'] == $NM_cmp_class)
  2773.       {
  2774.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_label'] == "desc")
  2775.           {
  2776.               $nome_img $this->Ini->Label_sort_desc;
  2777.           }
  2778.           else
  2779.           {
  2780.               $nome_img $this->Ini->Label_sort_asc;
  2781.           }
  2782.       }
  2783.       if (empty($this->Ini->Label_sort_pos) || $this->Ini->Label_sort_pos == "right")
  2784.       {
  2785.           $this->Ini->Label_sort_pos "right_field";
  2786.       }
  2787.       $Css_compl_sort " style=\"display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;justify-content:inherit;\"";
  2788.       if (empty($nome_img))
  2789.       {
  2790.           $link_img nl2br($SC_Label);
  2791.           $Css_compl_sort "";
  2792.       }
  2793.       elseif ($this->Ini->Label_sort_pos == "right_field")
  2794.       {
  2795.           $link_img "<span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2796.       }
  2797.       elseif ($this->Ini->Label_sort_pos == "left_field")
  2798.       {
  2799.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2800.       }
  2801.       elseif ($this->Ini->Label_sort_pos == "right_cell")
  2802.       {
  2803.           $link_img "<span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2804.       }
  2805.       elseif ($this->Ini->Label_sort_pos == "left_cell")
  2806.       {
  2807.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2808.       }
  2809.    $nm_saida->saida("<a href=\"javascript:nm_gp_submit2('" $NM_cmp_class "')\" class=\"" $this->css_scGridLabelLink "\"" $Css_compl_sort ">" $link_img "</a>\r\n");
  2810.    }
  2811.    else
  2812.    {
  2813.    $nm_saida->saida("" nl2br($SC_Label) . "\r\n");
  2814.    }
  2815.    $nm_saida->saida("</TD>\r\n");
  2816.    } 
  2817.  }
  2818.  function NM_label_veiculos_idveiculos()
  2819.  {
  2820.    global $nm_saida;
  2821.    $SC_Label = (isset($this->New_label['veiculos_idveiculos'])) ? $this->New_label['veiculos_idveiculos'] : "Id Veiculos"
  2822.    if (!isset($this->NM_cmp_hidden['veiculos_idveiculos']) || $this->NM_cmp_hidden['veiculos_idveiculos'] != "off") { 
  2823.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont $this->css_sep $this->css_veiculos_idveiculos_label "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_veiculos_idveiculos_label'] . "\" >" nl2br($SC_Label) . "</TD>\r\n");
  2824.    } 
  2825.  }
  2826.  function NM_label_veiculos_anomodelo()
  2827.  {
  2828.    global $nm_saida;
  2829.    $SC_Label = (isset($this->New_label['veiculos_anomodelo'])) ? $this->New_label['veiculos_anomodelo'] : "Ano Modelo"
  2830.    if (!isset($this->NM_cmp_hidden['veiculos_anomodelo']) || $this->NM_cmp_hidden['veiculos_anomodelo'] != "off") { 
  2831.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont $this->css_sep $this->css_veiculos_anomodelo_label "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_veiculos_anomodelo_label'] . "\" >" nl2br($SC_Label) . "</TD>\r\n");
  2832.    } 
  2833.  }
  2834.  function NM_label_veiculos_placa()
  2835.  {
  2836.    global $nm_saida;
  2837.    $SC_Label = (isset($this->New_label['veiculos_placa'])) ? $this->New_label['veiculos_placa'] : "Placa"
  2838.    if (!isset($this->NM_cmp_hidden['veiculos_placa']) || $this->NM_cmp_hidden['veiculos_placa'] != "off") { 
  2839.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont $this->css_sep $this->css_veiculos_placa_label "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_veiculos_placa_label'] . "\" >" nl2br($SC_Label) . "</TD>\r\n");
  2840.    } 
  2841.  }
  2842.  function NM_label_proprietarios_endereco()
  2843.  {
  2844.    global $nm_saida;
  2845.    $SC_Label = (isset($this->New_label['proprietarios_endereco'])) ? $this->New_label['proprietarios_endereco'] : "Endereco"
  2846.    if (!isset($this->NM_cmp_hidden['proprietarios_endereco']) || $this->NM_cmp_hidden['proprietarios_endereco'] != "off") { 
  2847.    $nm_saida->saida("     <TD class=\"" $this->css_scGridLabelFont $this->css_sep $this->css_proprietarios_endereco_label "\"  style=\"" $this->css_scGridLabelNowrap "" $this->Css_Cmp['css_proprietarios_endereco_label'] . "\" >\r\n");
  2848.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf")
  2849.    {
  2850.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  2851.       {
  2852.           $NM_cmp_class =  "Proprietarios.Endereco";
  2853.       }
  2854.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  2855.       {
  2856.           $NM_cmp_class =  "Proprietarios.Endereco";
  2857.       }
  2858.       else
  2859.       {
  2860.           $NM_cmp_class =  "proprietarios_endereco";
  2861.       }
  2862.       $link_img "";
  2863.       $nome_img $this->Ini->Label_sort;
  2864.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_cmp'] == $NM_cmp_class)
  2865.       {
  2866.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ordem_label'] == "desc")
  2867.           {
  2868.               $nome_img $this->Ini->Label_sort_desc;
  2869.           }
  2870.           else
  2871.           {
  2872.               $nome_img $this->Ini->Label_sort_asc;
  2873.           }
  2874.       }
  2875.       if (empty($this->Ini->Label_sort_pos) || $this->Ini->Label_sort_pos == "right")
  2876.       {
  2877.           $this->Ini->Label_sort_pos "right_field";
  2878.       }
  2879.       $Css_compl_sort " style=\"display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;justify-content:inherit;\"";
  2880.       if (empty($nome_img))
  2881.       {
  2882.           $link_img nl2br($SC_Label);
  2883.           $Css_compl_sort "";
  2884.       }
  2885.       elseif ($this->Ini->Label_sort_pos == "right_field")
  2886.       {
  2887.           $link_img "<span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2888.       }
  2889.       elseif ($this->Ini->Label_sort_pos == "left_field")
  2890.       {
  2891.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2892.       }
  2893.       elseif ($this->Ini->Label_sort_pos == "right_cell")
  2894.       {
  2895.           $link_img "<span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span><IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/>";
  2896.       }
  2897.       elseif ($this->Ini->Label_sort_pos == "left_cell")
  2898.       {
  2899.           $link_img "<IMG SRC=\"" $this->Ini->path_img_global "/" $nome_img "\" BORDER=\"0\"/><span style='display: inline-block; flex-grow: 1; white-space: normal; word-break: normal;'>" nl2br($SC_Label) . "</span>";
  2900.       }
  2901.    $nm_saida->saida("<a href=\"javascript:nm_gp_submit2('" $NM_cmp_class "')\" class=\"" $this->css_scGridLabelLink "\"" $Css_compl_sort ">" $link_img "</a>\r\n");
  2902.    }
  2903.    else
  2904.    {
  2905.    $nm_saida->saida("" nl2br($SC_Label) . "\r\n");
  2906.    }
  2907.    $nm_saida->saida("</TD>\r\n");
  2908.    } 
  2909.  }
  2910. // 
  2911. //----- 
  2912.  function grid($linhas 0)
  2913.  {
  2914.     global 
  2915.            $nm_saida;
  2916.    $fecha_tr               "</tr>";
  2917.    $this->Ini->qual_linha  "par";
  2918.    $HTTP_REFERER = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ""
  2919.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rows_emb'] = 0;
  2920.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2921.    {
  2922.        if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ini_cor_grid']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ini_cor_grid'] == "impar")
  2923.        {
  2924.            $this->Ini->qual_linha "impar";
  2925.            unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ini_cor_grid']);
  2926.        }
  2927.    }
  2928.    static $nm_seq_execucoes 0
  2929.    static $nm_seq_titulos   0
  2930.    $this->SC_ancora "";
  2931.    $this->Rows_span 1;
  2932.    $nm_seq_execucoes++; 
  2933.    $nm_seq_titulos++; 
  2934.    $this->nm_prim_linha  true
  2935.    $this->Ini->nm_cont_lin 0
  2936.    $this->sc_where_orig    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  2937.    $this->sc_where_atual   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  2938.    $this->sc_where_filtro  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'];
  2939. // 
  2940.    $SC_Label = (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario"
  2941.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels']['proprietarios_idproprietario'] = $SC_Label
  2942.    $SC_Label = (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome"
  2943.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels']['proprietarios_nome'] = $SC_Label
  2944.    $SC_Label = (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo"
  2945.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels']['proprietarios_sexo'] = $SC_Label
  2946.    $SC_Label = (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf"
  2947.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels']['proprietarios_cpf'] = $SC_Label
  2948.    $SC_Label = (isset($this->New_label['proprietarios_telefone'])) ? $this->New_label['proprietarios_telefone'] : "Telefone"
  2949.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels']['proprietarios_telefone'] = $SC_Label
  2950.    $SC_Label = (isset($this->New_label['veiculos_idveiculos'])) ? $this->New_label['veiculos_idveiculos'] : "Id Veiculos"
  2951.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels']['veiculos_idveiculos'] = $SC_Label
  2952.    $SC_Label = (isset($this->New_label['veiculos_anomodelo'])) ? $this->New_label['veiculos_anomodelo'] : "Ano Modelo"
  2953.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels']['veiculos_anomodelo'] = $SC_Label
  2954.    $SC_Label = (isset($this->New_label['veiculos_placa'])) ? $this->New_label['veiculos_placa'] : "Placa"
  2955.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels']['veiculos_placa'] = $SC_Label
  2956.    $SC_Label = (isset($this->New_label['proprietarios_endereco'])) ? $this->New_label['proprietarios_endereco'] : "Endereco"
  2957.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['labels']['proprietarios_endereco'] = $SC_Label
  2958.    if (!$this->grid_emb_form && isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['lig_edit']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['lig_edit'] != '')
  2959.    {
  2960.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['mostra_edit'] = $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['lig_edit'];
  2961.    }
  2962.    if (!empty($this->nm_grid_sem_reg))
  2963.    {
  2964.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2965.        {
  2966.            $this->Lin_impressas++;
  2967.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'])
  2968.            {
  2969.                if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cols_emb']) || empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cols_emb']))
  2970.                {
  2971.                    $cont_col 0;
  2972.                    foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $cada_field)
  2973.                    {
  2974.                        $cont_col++;
  2975.                    }
  2976.                    $NM_span_sem_reg $cont_col 1;
  2977.                }
  2978.                else
  2979.                {
  2980.                    $NM_span_sem_reg  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cols_emb'];
  2981.                }
  2982.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rows_emb']++;
  2983.                $nm_saida->saida("  <TR> <TD class=\"" $this->css_scGridTabelaTd " " "\" colspan = \"$NM_span_sem_reg\" align=\"center\" style=\"vertical-align: top;font-family:" $this->Ini->texto_fonte_tipo_impar ";font-size:12px;\">\r\n");
  2984.                $nm_saida->saida("     " $this->nm_grid_sem_reg "</TD> </TR>\r\n");
  2985.                $nm_saida->saida("##NM@@\r\n");
  2986.                $this->rs_grid->Close();
  2987.            }
  2988.            else
  2989.            {
  2990.                $nm_saida->saida("<table id=\"apl_grid_new#?#$nm_seq_execucoes\" width=\"100%\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;\">\r\n");
  2991.                $nm_saida->saida("  <tr><td class=\"" $this->css_scGridTabelaTd " " "\" style=\"font-family:" $this->Ini->texto_fonte_tipo_impar ";font-size:12px;\"><table style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;\" width=\"100%\">\r\n");
  2992.                $nm_id_aplicacao "";
  2993.                if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cab_embutida'] != "S")
  2994.                {
  2995.                    $this->label_grid($linhas);
  2996.                }
  2997.                $this->NM_calc_span();
  2998.                $nm_saida->saida("  <tr><td class=\"" $this->css_scGridFieldOdd "\"  style=\"padding: 0px; font-family:" $this->Ini->texto_fonte_tipo_impar ";font-size:12px;\" colspan = \"" $this->NM_colspan "\" align=\"center\">\r\n");
  2999.                $nm_saida->saida("     " $this->nm_grid_sem_reg "\r\n");
  3000.                $nm_saida->saida("  </td></tr>\r\n");
  3001.                $nm_saida->saida("  </table></td></tr></table>\r\n");
  3002.                $this->Lin_final $this->rs_grid->EOF;
  3003.                if ($this->Lin_final)
  3004.                {
  3005.                    $this->rs_grid->Close();
  3006.                }
  3007.            }
  3008.        }
  3009.        else
  3010.        {
  3011.            $nm_saida->saida(" <TR> \r\n");
  3012.            $nm_saida->saida("  <td " $this->Grid_body " class=\"" $this->css_scGridTabelaTd " " $this->css_scGridFieldOdd "\" align=\"center\" style=\"vertical-align: top;font-family:" $this->Ini->texto_fonte_tipo_impar ";font-size:12px;\">\r\n");
  3013.            if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['force_toolbar']))
  3014.            { 
  3015.                $this->force_toolbar true;
  3016.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['force_toolbar'] = true;
  3017.            } 
  3018.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  3019.            { 
  3020.                $_SESSION['scriptcase']['saida_html'] = "";
  3021.            } 
  3022.            $nm_saida->saida("  " $this->nm_grid_sem_reg "\r\n");
  3023.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  3024.            { 
  3025.                $this->Ini->Arr_result['setValue'][] = array('field' => 'sc_grid_body''value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
  3026.                $_SESSION['scriptcase']['saida_html'] = "";
  3027.            } 
  3028.            $nm_saida->saida("  </td></tr>\r\n");
  3029.        }
  3030.        return;
  3031.    }
  3032.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  3033.    { 
  3034.        $nm_saida->saida("<table id=\"apl_grid_new#?#$nm_seq_execucoes\" width=\"100%\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;\">\r\n");
  3035.        $nm_saida->saida(" <TR> \r\n");
  3036.        $nm_id_aplicacao "";
  3037.    } 
  3038.    else 
  3039.    { 
  3040. if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3041. {
  3042. }
  3043. else
  3044. {
  3045.        $nm_saida->saida("    <TR> \r\n");
  3046. }
  3047.        $nm_id_aplicacao " id=\"apl_grid_new#?#1\"";
  3048.    } 
  3049.    $TD_padding = (!$this->Print_All && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf") ? "padding: 0px !important;" "";
  3050. if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert'])
  3051. {
  3052. }
  3053. else
  3054. {
  3055.    $nm_saida->saida("  <TD " $this->Grid_body " class=\"" $this->css_scGridTabelaTd "\" style=\"vertical-align: top;text-align: center;" $TD_padding "\">\r\n");
  3056. }
  3057.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  3058.    { 
  3059.        $_SESSION['scriptcase']['saida_html'] = "";
  3060.    } 
  3061.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'])
  3062.    { 
  3063.        $nm_saida->saida("        <div id=\"div_FBtn_Run\" style=\"display: none\"> \r\n");
  3064.        $nm_saida->saida("        <form name=\"Fpesq\" method=post>\r\n");
  3065.        $nm_saida->saida("         <input type=hidden name=\"nm_ret_psq\"> \r\n");
  3066.        $nm_saida->saida("        </div> \r\n");
  3067.    } 
  3068. if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf']) { 
  3069.     if ($this->pdf_all_cab != "S") {
  3070.         $this->cabecalho();
  3071.     }
  3072.     $nm_saida->saida("              <thead>\r\n");
  3073.     if ($this->pdf_all_cab == "S") {
  3074.         $this->cabecalho();
  3075.     }
  3076.     if ($this->pdf_all_label == "S") {
  3077.         $this->label_grid();
  3078.     }
  3079. }
  3080.  if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf']) { 
  3081.  }else { 
  3082.    $nm_saida->saida("   <TABLE class=\"" $this->css_scGridTabela "\" id=\"sc-ui-grid-body-de1543de\" align=\"center\" " $nm_id_aplicacao " width=\"100%\">\r\n");
  3083.  }
  3084.  if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert']) { 
  3085.     $nm_saida->saida("</thead>\r\n");
  3086.  }
  3087.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] && $this->pdf_all_label != "S" && $this->pdf_label_group != "S"
  3088.    { 
  3089.       $this->label_grid($linhas);
  3090.    } 
  3091.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'])
  3092.    { 
  3093.        $_SESSION['scriptcase']['saida_html'] = "";
  3094.    } 
  3095. // 
  3096.    $nm_quant_linhas ;
  3097.    $this->nm_inicio_pag 0;
  3098.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  3099.    { 
  3100.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final'] = 0;
  3101.    } 
  3102.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total")
  3103.    {
  3104.        $NM_prim_qb true;
  3105.    }
  3106.    $this->nmgp_prim_pag_pdf true;
  3107.    $this->Break_pag_pdf = array();
  3108.    $this->Break_pag_prt = array();
  3109.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Config_Page_break_PDF'] = "S";
  3110.    if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Page_break_PDF']))
  3111.    {
  3112.        if (isset($this->Break_pag_pdf[$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby']]))
  3113.        {
  3114.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by")
  3115.            {
  3116.                foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp'] as $Cmp_gb => $resto)
  3117.                {
  3118.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Page_break_PDF'][$Cmp_gb] = $this->Break_pag_pdf['sc_free_group_by'][$Cmp_gb];
  3119.                }
  3120.            }
  3121.            else
  3122.            {
  3123.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Page_break_PDF'] = $this->Break_pag_pdf[$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby']];
  3124.            }
  3125.        }
  3126.        else
  3127.        {
  3128.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Page_break_PDF'] = array();
  3129.        }
  3130.    }
  3131.    $this->Ini->cor_link_dados $this->css_scGridFieldEvenLink;
  3132.    $this->NM_flag_antigo FALSE;
  3133.    $this->sc_where_Min $_SESSION['scriptcase'][$this->sc_where_Min];
  3134.    $nm_prog_barr 0;
  3135.    $PB_tot       "/" $this->count_ger;;
  3136.    while (!$this->rs_grid->EOF && $nm_quant_linhas $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid'] && ($linhas == || $linhas $this->Lin_impressas)) 
  3137.    {  
  3138.           $this->Rows_span 1;
  3139.           $this->NM_field_style = array();
  3140.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word'] && !$this->Ini->sc_export_ajax)
  3141.           {
  3142.               $nm_prog_barr++;
  3143.               $Mens_bar $this->Ini->Nm_lang['lang_othr_prcs'];
  3144.               if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  3145.                   $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  3146.               }
  3147.               $this->pb->setProgressbarMessage($Mens_bar ": " $nm_prog_barr $PB_tot);
  3148.               $this->pb->addSteps(1);
  3149.           }
  3150.           if ($this->Ini->Proc_print && $this->Ini->Export_html_zip  && !$this->Ini->sc_export_ajax)
  3151.           {
  3152.               $nm_prog_barr++;
  3153.               $Mens_bar $this->Ini->Nm_lang['lang_othr_prcs'];
  3154.               if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  3155.                   $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  3156.               }
  3157.               $this->pb->setProgressbarMessage($Mens_bar ": " $nm_prog_barr $PB_tot);
  3158.               $this->pb->addSteps(1);
  3159.           }
  3160.           //---------- Gauge ----------
  3161.           if (!$this->Ini->sc_export_ajax && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" && -$this->progress_grid)
  3162.           {
  3163.               $this->progress_now++;
  3164.               if (== $this->progress_lim_now)
  3165.               {
  3166.                $lang_protect $this->Ini->Nm_lang['lang_pdff_rows'];
  3167.                if (!NM_is_utf8($lang_protect))
  3168.                {
  3169.                    $lang_protect sc_convert_encoding($lang_protect"UTF-8"$_SESSION['scriptcase']['charset']);
  3170.                }
  3171.                   fwrite($this->progress_fp$this->progress_now "_#NM#_" $lang_protect " " $this->progress_now "...\n");
  3172.               }
  3173.               $this->progress_lim_now++;
  3174.               if ($this->progress_lim_tot == $this->progress_lim_now)
  3175.               {
  3176.                   $this->progress_lim_now 0;
  3177.               }
  3178.           }
  3179.           $this->Lin_impressas++;
  3180.           $this->proprietarios_idproprietario $this->rs_grid->fields[0] ;  
  3181.           $this->proprietarios_idproprietario = (string)$this->proprietarios_idproprietario;
  3182.           $this->proprietarios_nome $this->rs_grid->fields[1] ;  
  3183.           $this->proprietarios_sexo $this->rs_grid->fields[2] ;  
  3184.           $this->proprietarios_cpf $this->rs_grid->fields[3] ;  
  3185.           $this->proprietarios_cpf = (string)$this->proprietarios_cpf;
  3186.           $this->proprietarios_telefone $this->rs_grid->fields[4] ;  
  3187.           $this->veiculos_idveiculos $this->rs_grid->fields[5] ;  
  3188.           $this->veiculos_idveiculos = (string)$this->veiculos_idveiculos;
  3189.           $this->veiculos_anomodelo $this->rs_grid->fields[6] ;  
  3190.           $this->veiculos_placa $this->rs_grid->fields[7] ;  
  3191.           $this->proprietarios_endereco $this->rs_grid->fields[8] ;  
  3192.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  3193.          {
  3194.           if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  3195.           {
  3196.               $this->Res->nm_acum_res_unit($this->rs_grid);
  3197.           }
  3198.          }
  3199.           $this->SC_seq_page++; 
  3200.           $this->SC_seq_register $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final'] + 1
  3201.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rows_emb']++;
  3202.           $this->sc_proc_grid true;
  3203.           if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3204.           {
  3205.               if ($nm_houve_quebra == "S" || $this->nm_inicio_pag == 0)
  3206.               { 
  3207.                   if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid']) {
  3208.                       $this->label_grid($linhas);
  3209.                   } 
  3210.                   $nm_houve_quebra "N";
  3211.               } 
  3212.           } 
  3213.           $this->nm_inicio_pag++;
  3214.           if (!$this->NM_flag_antigo)
  3215.           {
  3216.              $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final']++ ; 
  3217.           }
  3218.           $seq_det =  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['final']; 
  3219.           $this->Ini->cor_link_dados = ($this->Ini->cor_link_dados == $this->css_scGridFieldOddLink) ? $this->css_scGridFieldEvenLink $this->css_scGridFieldOddLink
  3220.           $this->Ini->qual_linha   = ($this->Ini->qual_linha == "par") ? "impar" "par";
  3221.           if ("impar" == $this->Ini->qual_linha)
  3222.           {
  3223.               $this->css_line_back $this->css_scGridFieldOdd;
  3224.               $this->css_line_fonf $this->css_scGridFieldOddFont;
  3225.           }
  3226.           else
  3227.           {
  3228.               $this->css_line_back $this->css_scGridFieldEven;
  3229.               $this->css_line_fonf $this->css_scGridFieldEvenFont;
  3230.           }
  3231.           $NM_destaque " onmouseover=\"over_tr(this, '" $this->css_line_back "');\" onmouseout=\"out_tr(this, '" $this->css_line_back "');\" onclick=\"click_tr(this, '" $this->css_line_back "');\"";
  3232.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'])
  3233.           {
  3234.              $NM_destaque ="";
  3235.           }
  3236.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'])
  3237.           {
  3238.               $temp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dado_psq_ret'];
  3239.               eval("\$teste = \$this->$temp;");
  3240.           }
  3241.           $this->SC_ancora $this->SC_seq_page;
  3242.           $nm_saida->saida("    <TR  class=\"" $this->css_line_back "\"  style=\"page-break-inside: avoid;\"" $NM_destaque " id=\"SC_ancor" $this->SC_ancora "\">\r\n");
  3243.  if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid']){ 
  3244.           $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_scGridBlockBg "\" style=\"width: " $this->width_tabula_quebra "; display:" $this->width_tabula_display ";\"  style=\"" $this->Css_Cmp['css_proprietarios_endereco_grid_line'] . "\" NOWRAP align=\"\" valign=\"\"   HEIGHT=\"0px\">&nbsp;</TD>\r\n");
  3245.  }
  3246.  if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq']){ 
  3247.           $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf "\"  style=\"" $this->Css_Cmp['css_proprietarios_endereco_grid_line'] . "\" NOWRAP align=\"left\" valign=\"top\" WIDTH=\"1px\"  HEIGHT=\"0px\">\r\n");
  3248.  $Cod_Btn nmButtonOutput($this->arr_buttons"bcapture""document.Fpesq.nm_ret_psq.value='" $teste "'; nm_escreve_window();""document.Fpesq.nm_ret_psq.value='" $teste "'; nm_escreve_window();""""Rad_psq""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3249.           $nm_saida->saida($Cod_Btn</TD>\r\n");
  3250.  } 
  3251.  if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['mostra_edit'] != "N"){ 
  3252.               $Sc_parent = ($this->grid_emb_form || $this->grid_emb_form_full) ? "S" "";
  3253.               $Parms_Det  "nmgp_chave_det?#?" $this->proprietarios_idproprietario "*PDet*" $this->proprietarios_nome "*PDet*" $this->proprietarios_sexo "*PDet*" $this->proprietarios_cpf "*PDet*" $this->proprietarios_telefone "*PDet*" $this->veiculos_idveiculos "*PDet*" $this->veiculos_anomodelo "*PDet*" $this->veiculos_placa "*PDet*" $this->proprietarios_endereco "?@?Sc_seq_det?#?" $this->SC_seq_register "?#?";
  3254.               $Md5_Det    "@SC_par@" NM_encode_input($this->Ini->sc_page) . "@SC_par@grid_new@SC_par@" md5($Parms_Det);
  3255.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Lig_Md5'][md5($Parms_Det)] = $Parms_Det;
  3256.               $Link_Det  nmButtonOutput($this->arr_buttons"bcons_detalhes""nm_gp_submit3('" $Md5_Det "', '', 'detalhe', '" $this->SC_ancora "')""nm_gp_submit3('" $Md5_Det "', '', 'detalhe', '" $this->SC_ancora "')""""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3257.           $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf "\"  NOWRAP align=\"center\" valign=\"top\" WIDTH=\"1px\"  HEIGHT=\"0px\"><table style=\"padding: 0px; border-spacing: 0px; border-width: 0px;\"><tr><td style=\"padding: 0px\">" $Link_Det "</td></tr></table></TD>\r\n");
  3258.  } 
  3259.  if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['mostra_edit'] == "N"){ 
  3260.               $Sc_parent = ($this->grid_emb_form || $this->grid_emb_form_full) ? "S" "";
  3261.               $Parms_Det  "nmgp_chave_det?#?" $this->proprietarios_idproprietario "*PDet*" $this->proprietarios_nome "*PDet*" $this->proprietarios_sexo "*PDet*" $this->proprietarios_cpf "*PDet*" $this->proprietarios_telefone "*PDet*" $this->veiculos_idveiculos "*PDet*" $this->veiculos_anomodelo "*PDet*" $this->veiculos_placa "*PDet*" $this->proprietarios_endereco "?@?Sc_seq_det?#?" $this->SC_seq_register "?#?";
  3262.               $Md5_Det    "@SC_par@" NM_encode_input($this->Ini->sc_page) . "@SC_par@grid_new@SC_par@" md5($Parms_Det);
  3263.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Lig_Md5'][md5($Parms_Det)] = $Parms_Det;
  3264.               $Link_Det  nmButtonOutput($this->arr_buttons"bcons_detalhes""nm_gp_submit3('" $Md5_Det "', '', 'detalhe', '" $this->SC_ancora "')""nm_gp_submit3('" $Md5_Det "', '', 'detalhe', '" $this->SC_ancora "')""""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3265.           $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf "\"  NOWRAP align=\"center\" valign=\"top\" WIDTH=\"1px\"  HEIGHT=\"0px\"><table style=\"padding: 0px; border-spacing: 0px; border-width: 0px;\"><tr><td style=\"padding: 0px\">" $Link_Det "</td></tr></table></TD>\r\n");
  3266.  } 
  3267.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_col)
  3268.           { 
  3269.               $NM_func_grid "NM_grid_" $Cada_col;
  3270.               $this->$NM_func_grid();
  3271.           } 
  3272.           $nm_saida->saida("</TR>\r\n");
  3273.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'] && $this->nm_prim_linha)
  3274.           { 
  3275.               $nm_saida->saida("##NM@@"); 
  3276.               $this->nm_prim_linha false
  3277.           } 
  3278.           $this->rs_grid->MoveNext();
  3279.           $this->sc_proc_grid false;
  3280.           if ($this->sc_where_Min != $this->sc_where_Max) { $this->rs_grid->Close(); }
  3281.           $nm_quant_linhas++ ;
  3282.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" || $this->Ini->Apl_paginacao == "FULL")
  3283.           { 
  3284.               $nm_quant_linhas 0
  3285.           } 
  3286.    }  
  3287.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  3288.    { 
  3289.       $this->Lin_final $this->rs_grid->EOF;
  3290.       if ($this->Lin_final)
  3291.       {
  3292.          $this->rs_grid->Close();
  3293.       }
  3294.    } 
  3295.    else
  3296.    {
  3297.       $this->rs_grid->Close();
  3298.    }
  3299.    if (!$this->rs_grid->EOF
  3300.    { 
  3301.        if (isset($this->NM_tbody_open) && $this->NM_tbody_open)
  3302.        {
  3303.            $nm_saida->saida("    </TBODY>");
  3304.        }
  3305.    } 
  3306.    if ($this->rs_grid->EOF
  3307.    { 
  3308.   
  3309.        if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['exibe_total'] == "S")
  3310.        { 
  3311.            $Gb_geral "quebra_geral_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] . "_top";
  3312.            $this->$Gb_geral() ;
  3313.        } 
  3314.    }  
  3315.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'])
  3316.    {
  3317.        $nm_saida->saida("X##NM@@X");
  3318.    }
  3319.    $nm_saida->saida("</TABLE>");
  3320.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'])
  3321.    { 
  3322.           $nm_saida->saida("       </form>\r\n");
  3323.    } 
  3324.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  3325.    { 
  3326.        $this->Ini->Arr_result['setValue'][] = array('field' => 'sc_grid_body''value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
  3327.        $_SESSION['scriptcase']['saida_html'] = "";
  3328.    } 
  3329.    $nm_saida->saida("</TD>");
  3330.    $nm_saida->saida($fecha_tr);
  3331.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'])
  3332.    { 
  3333.        return; 
  3334.    } 
  3335.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  3336.    { 
  3337.        $_SESSION['scriptcase']['contr_link_emb'] = "";   
  3338.    } 
  3339.            $nm_saida->saida("    </TR>\r\n");
  3340.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  3341.    {
  3342.        $nm_saida->saida("</TABLE>\r\n");
  3343.    }
  3344.    if ($this->Print_All
  3345.    { 
  3346.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']       = "igual" 
  3347.    } 
  3348.  }
  3349.  function NM_grid_proprietarios_idproprietario()
  3350.  {
  3351.       global $nm_saida;
  3352.       if (!isset($this->NM_cmp_hidden['proprietarios_idproprietario']) || $this->NM_cmp_hidden['proprietarios_idproprietario'] != "off") { 
  3353.           $conteudo NM_encode_input(sc_strip_script($this->proprietarios_idproprietario)); 
  3354.           if ($conteudo === ""
  3355.           { 
  3356.               $conteudo "&nbsp;" ;  
  3357.               $graf "" ;  
  3358.           } 
  3359.           else    
  3360.           { 
  3361.               nmgp_Form_Num_Val($conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  3362.           } 
  3363.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3364.           {
  3365.               $this->SC_nowrap "NOWRAP";
  3366.           }
  3367.           else
  3368.           {
  3369.               $this->SC_nowrap "NOWRAP";
  3370.           }
  3371.    $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf $this->css_sep $this->css_proprietarios_idproprietario_grid_line "\"  style=\"" $this->Css_Cmp['css_proprietarios_idproprietario_grid_line'] . "\" " $this->SC_nowrap " align=\"\" valign=\"top\"   HEIGHT=\"0px\"><span id=\"id_sc_field_proprietarios_idproprietario_" $this->SC_seq_page "\">" $conteudo "</span></TD>\r\n");
  3372.       }
  3373.  }
  3374.  function NM_grid_proprietarios_nome()
  3375.  {
  3376.       global $nm_saida;
  3377.       if (!isset($this->NM_cmp_hidden['proprietarios_nome']) || $this->NM_cmp_hidden['proprietarios_nome'] != "off") { 
  3378.           $conteudo sc_strip_script($this->proprietarios_nome); 
  3379.           if ($conteudo === ""
  3380.           { 
  3381.               $conteudo "&nbsp;" ;  
  3382.               $graf "" ;  
  3383.           } 
  3384.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3385.           {
  3386.               $this->SC_nowrap "";
  3387.           }
  3388.           else
  3389.           {
  3390.               $this->SC_nowrap "";
  3391.           }
  3392.    $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf $this->css_sep $this->css_proprietarios_nome_grid_line "\"  style=\"" $this->Css_Cmp['css_proprietarios_nome_grid_line'] . "\" " $this->SC_nowrap " align=\"\" valign=\"top\"   HEIGHT=\"0px\"><span id=\"id_sc_field_proprietarios_nome_" $this->SC_seq_page "\">" $conteudo "</span></TD>\r\n");
  3393.       }
  3394.  }
  3395.  function NM_grid_proprietarios_sexo()
  3396.  {
  3397.       global $nm_saida;
  3398.       if (!isset($this->NM_cmp_hidden['proprietarios_sexo']) || $this->NM_cmp_hidden['proprietarios_sexo'] != "off") { 
  3399.           $conteudo sc_strip_script($this->proprietarios_sexo); 
  3400.           if ($conteudo === ""
  3401.           { 
  3402.               $conteudo "&nbsp;" ;  
  3403.               $graf "" ;  
  3404.           } 
  3405.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3406.           {
  3407.               $this->SC_nowrap "";
  3408.           }
  3409.           else
  3410.           {
  3411.               $this->SC_nowrap "";
  3412.           }
  3413.    $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf $this->css_sep $this->css_proprietarios_sexo_grid_line "\"  style=\"" $this->Css_Cmp['css_proprietarios_sexo_grid_line'] . "\" " $this->SC_nowrap " align=\"\" valign=\"top\"   HEIGHT=\"0px\"><span id=\"id_sc_field_proprietarios_sexo_" $this->SC_seq_page "\">" $conteudo "</span></TD>\r\n");
  3414.       }
  3415.  }
  3416.  function NM_grid_proprietarios_cpf()
  3417.  {
  3418.       global $nm_saida;
  3419.       if (!isset($this->NM_cmp_hidden['proprietarios_cpf']) || $this->NM_cmp_hidden['proprietarios_cpf'] != "off") { 
  3420.           $conteudo NM_encode_input(sc_strip_script($this->proprietarios_cpf)); 
  3421.           if ($conteudo === ""
  3422.           { 
  3423.               $conteudo "&nbsp;" ;  
  3424.               $graf "" ;  
  3425.           } 
  3426.           else    
  3427.           { 
  3428.               nmgp_Form_Num_Val($conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  3429.           } 
  3430.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3431.           {
  3432.               $this->SC_nowrap "NOWRAP";
  3433.           }
  3434.           else
  3435.           {
  3436.               $this->SC_nowrap "NOWRAP";
  3437.           }
  3438.    $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf $this->css_sep $this->css_proprietarios_cpf_grid_line "\"  style=\"" $this->Css_Cmp['css_proprietarios_cpf_grid_line'] . "\" " $this->SC_nowrap " align=\"\" valign=\"top\"   HEIGHT=\"0px\"><span id=\"id_sc_field_proprietarios_cpf_" $this->SC_seq_page "\">" $conteudo "</span></TD>\r\n");
  3439.       }
  3440.  }
  3441.  function NM_grid_proprietarios_telefone()
  3442.  {
  3443.       global $nm_saida;
  3444.       if (!isset($this->NM_cmp_hidden['proprietarios_telefone']) || $this->NM_cmp_hidden['proprietarios_telefone'] != "off") { 
  3445.           $conteudo sc_strip_script($this->proprietarios_telefone); 
  3446.           if ($conteudo === ""
  3447.           { 
  3448.               $conteudo "&nbsp;" ;  
  3449.               $graf "" ;  
  3450.           } 
  3451.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3452.           {
  3453.               $this->SC_nowrap "";
  3454.           }
  3455.           else
  3456.           {
  3457.               $this->SC_nowrap "";
  3458.           }
  3459.    $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf $this->css_sep $this->css_proprietarios_telefone_grid_line "\"  style=\"" $this->Css_Cmp['css_proprietarios_telefone_grid_line'] . "\" " $this->SC_nowrap " align=\"\" valign=\"top\"   HEIGHT=\"0px\"><span id=\"id_sc_field_proprietarios_telefone_" $this->SC_seq_page "\">" $conteudo "</span></TD>\r\n");
  3460.       }
  3461.  }
  3462.  function NM_grid_veiculos_idveiculos()
  3463.  {
  3464.       global $nm_saida;
  3465.       if (!isset($this->NM_cmp_hidden['veiculos_idveiculos']) || $this->NM_cmp_hidden['veiculos_idveiculos'] != "off") { 
  3466.           $conteudo NM_encode_input(sc_strip_script($this->veiculos_idveiculos)); 
  3467.           if ($conteudo === ""
  3468.           { 
  3469.               $conteudo "&nbsp;" ;  
  3470.               $graf "" ;  
  3471.           } 
  3472.           else    
  3473.           { 
  3474.               nmgp_Form_Num_Val($conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  3475.           } 
  3476.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3477.           {
  3478.               $this->SC_nowrap "NOWRAP";
  3479.           }
  3480.           else
  3481.           {
  3482.               $this->SC_nowrap "NOWRAP";
  3483.           }
  3484.    $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf $this->css_sep $this->css_veiculos_idveiculos_grid_line "\"  style=\"" $this->Css_Cmp['css_veiculos_idveiculos_grid_line'] . "\" " $this->SC_nowrap " align=\"\" valign=\"top\"   HEIGHT=\"0px\"><span id=\"id_sc_field_veiculos_idveiculos_" $this->SC_seq_page "\">" $conteudo "</span></TD>\r\n");
  3485.       }
  3486.  }
  3487.  function NM_grid_veiculos_anomodelo()
  3488.  {
  3489.       global $nm_saida;
  3490.       if (!isset($this->NM_cmp_hidden['veiculos_anomodelo']) || $this->NM_cmp_hidden['veiculos_anomodelo'] != "off") { 
  3491.           $conteudo sc_strip_script($this->veiculos_anomodelo); 
  3492.           if ($conteudo === ""
  3493.           { 
  3494.               $conteudo "&nbsp;" ;  
  3495.               $graf "" ;  
  3496.           } 
  3497.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3498.           {
  3499.               $this->SC_nowrap "";
  3500.           }
  3501.           else
  3502.           {
  3503.               $this->SC_nowrap "";
  3504.           }
  3505.    $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf $this->css_sep $this->css_veiculos_anomodelo_grid_line "\"  style=\"" $this->Css_Cmp['css_veiculos_anomodelo_grid_line'] . "\" " $this->SC_nowrap " align=\"\" valign=\"top\"   HEIGHT=\"0px\"><span id=\"id_sc_field_veiculos_anomodelo_" $this->SC_seq_page "\">" $conteudo "</span></TD>\r\n");
  3506.       }
  3507.  }
  3508.  function NM_grid_veiculos_placa()
  3509.  {
  3510.       global $nm_saida;
  3511.       if (!isset($this->NM_cmp_hidden['veiculos_placa']) || $this->NM_cmp_hidden['veiculos_placa'] != "off") { 
  3512.           $conteudo sc_strip_script($this->veiculos_placa); 
  3513.           if ($conteudo === ""
  3514.           { 
  3515.               $conteudo "&nbsp;" ;  
  3516.               $graf "" ;  
  3517.           } 
  3518.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3519.           {
  3520.               $this->SC_nowrap "";
  3521.           }
  3522.           else
  3523.           {
  3524.               $this->SC_nowrap "";
  3525.           }
  3526.    $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf $this->css_sep $this->css_veiculos_placa_grid_line "\"  style=\"" $this->Css_Cmp['css_veiculos_placa_grid_line'] . "\" " $this->SC_nowrap " align=\"\" valign=\"top\"   HEIGHT=\"0px\"><span id=\"id_sc_field_veiculos_placa_" $this->SC_seq_page "\">" $conteudo "</span></TD>\r\n");
  3527.       }
  3528.  }
  3529.  function NM_grid_proprietarios_endereco()
  3530.  {
  3531.       global $nm_saida;
  3532.       if (!isset($this->NM_cmp_hidden['proprietarios_endereco']) || $this->NM_cmp_hidden['proprietarios_endereco'] != "off") { 
  3533.           $conteudo sc_strip_script($this->proprietarios_endereco); 
  3534.           if ($conteudo === ""
  3535.           { 
  3536.               $conteudo "&nbsp;" ;  
  3537.               $graf "" ;  
  3538.           } 
  3539.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'])
  3540.           {
  3541.               $this->SC_nowrap "";
  3542.           }
  3543.           else
  3544.           {
  3545.               $this->SC_nowrap "";
  3546.           }
  3547.    $nm_saida->saida("     <TD rowspan=\"" $this->Rows_span "\" class=\"" $this->css_line_fonf $this->css_sep $this->css_proprietarios_endereco_grid_line "\"  style=\"" $this->Css_Cmp['css_proprietarios_endereco_grid_line'] . "\" " $this->SC_nowrap " align=\"\" valign=\"top\"   HEIGHT=\"0px\"><span id=\"id_sc_field_proprietarios_endereco_" $this->SC_seq_page "\">" $conteudo "</span></TD>\r\n");
  3548.       }
  3549.  }
  3550.  function NM_calc_span()
  3551.  {
  3552.    $this->NM_colspan  11;
  3553.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'])
  3554.    {
  3555.        $this->NM_colspan++;
  3556.    }
  3557.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_pdf'] == "pdf")
  3558.    {
  3559.        $this->NM_colspan--;
  3560.    } 
  3561.    foreach ($this->NM_cmp_hidden as $Cmp => $Hidden)
  3562.    {
  3563.        if ($Hidden == "off")
  3564.        {
  3565.            $this->NM_colspan--;
  3566.        }
  3567.    }
  3568.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'])
  3569.    {
  3570.        $this->NM_colspan--;
  3571.    }
  3572.  }
  3573.  function nm_quebra_pagina($nm_parms)
  3574.  {
  3575.     global $nm_saida;
  3576.     if ($this->nmgp_prim_pag_pdf && $nm_parms == "pagina")
  3577.     {
  3578.         $this->nmgp_prim_pag_pdf false;
  3579.         return;
  3580.     }
  3581.     $this->Ini->nm_cont_lin++;
  3582.     if (($this->Ini->nm_limite_lin && $this->Ini->nm_cont_lin $this->Ini->nm_limite_lin) || $nm_parms == "pagina" || $nm_parms == "resumo" || $nm_parms == "total")
  3583.     {
  3584.         $nm_saida->saida("</TABLE></TD></TR>\r\n");
  3585.         $this->Ini->nm_cont_lin = ($nm_parms == "pagina") ? 1;
  3586.         if ($this->Print_All)
  3587.         {
  3588.             if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_navigator']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_navigator'] == "Netscape")
  3589.             {
  3590.                 $nm_saida->saida("</TABLE><TABLE id=\"main_table_grid\" style=\"page-break-before:always;\" align=\"" $this->Tab_align "\" valign=\"" $this->Tab_valign "\" " $this->Tab_width ">\r\n");
  3591.             }
  3592.             else
  3593.             {
  3594.                 $nm_saida->saida("</TABLE><TABLE id=\"main_table_grid\" class=\"scGridBorder\" style=\"page-break-before:always;\" align=\"" $this->Tab_align "\" valign=\"" $this->Tab_valign "\" " $this->Tab_width ">\r\n");
  3595.             }
  3596.         }
  3597.         else
  3598.         {
  3599.             $nm_saida->saida("</table><div style=\"page-break-after: always;\"><span style=\"display: none;\">&nbsp;</span></div><table width='100%' cellspacing=0 cellpadding=0>\r\n");
  3600.         }
  3601.         if ($nm_parms != "resumo" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  3602.         {
  3603.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf']) { 
  3604.            }
  3605.            else
  3606.            {
  3607.                if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert']) { 
  3608.                 $nm_saida->saida("     <thead>\r\n");
  3609.                }
  3610.                $this->cabecalho();
  3611.                if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert']) { 
  3612.                 $nm_saida->saida("     </thead>\r\n");
  3613.                }
  3614.            }
  3615.         }
  3616.         $nm_saida->saida(" <TR> \r\n");
  3617.         $nm_saida->saida("  <TD style=\"padding: 0px; vertical-align: top;\"> \r\n");
  3618.         $nm_saida->saida("   <TABLE class=\"" $this->css_scGridTabela "\" align=\"center\" " $nm_id_aplicacao " width=\"100%\">\r\n");
  3619.         if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] && ($this->pdf_all_cab == "S" || $this->pdf_all_label == "S")) { 
  3620.             $nm_saida->saida(" <thead> \r\n");
  3621.             if ($this->pdf_all_cab == "S")
  3622.             {
  3623.                 $this->cabecalho();
  3624.             }
  3625.             if ($this->pdf_all_label == "S" && $nm_parms != "resumo" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'])
  3626.             {
  3627.                 $this->label_grid();
  3628.             }
  3629.             $nm_saida->saida(" </thead> \r\n");
  3630.         }
  3631.         if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] && $nm_parms != "resumo" && $nm_parms != "pagina" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'])
  3632.         {
  3633.             $this->label_grid();
  3634.         }
  3635.         if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf'] && $this->pdf_label_group != "S" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'])
  3636.         {
  3637.             $this->nm_inicio_pag 0;
  3638.         }
  3639.     }
  3640.  }
  3641.  function quebra_geral_sc_free_total_top() 
  3642.  {
  3643.    global $nm_saida
  3644.    if (isset($this->NM_tbody_open) && $this->NM_tbody_open)
  3645.    {
  3646.        $nm_saida->saida("    </TBODY>");
  3647.    }
  3648.  }
  3649.  function quebra_geral_sc_free_total_bot() 
  3650.  {
  3651.  }
  3652.    function nm_conv_data_db($dt_in$form_in$form_out)
  3653.    {
  3654.        $dt_out $dt_in;
  3655.        if (strtoupper($form_in) == "DB_FORMAT")
  3656.        {
  3657.            if ($dt_out == "null" || $dt_out == "")
  3658.            {
  3659.                $dt_out "";
  3660.                return $dt_out;
  3661.            }
  3662.            $form_in "AAAA-MM-DD";
  3663.        }
  3664.        if (strtoupper($form_out) == "DB_FORMAT")
  3665.        {
  3666.            if (empty($dt_out))
  3667.            {
  3668.                $dt_out "null";
  3669.                return $dt_out;
  3670.            }
  3671.            $form_out "AAAA-MM-DD";
  3672.        }
  3673.        nm_conv_form_data($dt_out$form_in$form_out);
  3674.        return $dt_out;
  3675.    }
  3676.    function nmgp_barra_top_normal()
  3677.    {
  3678.       global 
  3679.              $nm_saida$nm_url_saida$nm_apl_dependente;
  3680.       $NM_btn  false;
  3681.       $NM_Gbtn false;
  3682.       $nm_saida->saida("      <tr style=\"display: none\">\r\n");
  3683.       $nm_saida->saida("      <td>\r\n");
  3684.       $nm_saida->saida("      <form id=\"id_F0_top\" name=\"F0_top\" method=\"post\" action=\"./\" target=\"_self\"> \r\n");
  3685.       $nm_saida->saida("      <input type=\"text\" id=\"id_sc_truta_f0_top\" name=\"sc_truta_f0_top\" value=\"\"/> \r\n");
  3686.       $nm_saida->saida("      <input type=\"hidden\" id=\"script_init_f0_top\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  3687.       $nm_saida->saida("      <input type=hidden id=\"script_session_f0_top\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/>\r\n");
  3688.       $nm_saida->saida("      <input type=\"hidden\" id=\"opcao_f0_top\" name=\"nmgp_opcao\" value=\"muda_qt_linhas\"/> \r\n");
  3689.       $nm_saida->saida("      </td></tr><tr>\r\n");
  3690.       $nm_saida->saida("       <td id=\"sc_grid_toobar_top\"  class=\"" $this->css_scGridTabelaTd "\" valign=\"top\"> \r\n");
  3691.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  3692.       { 
  3693.           $_SESSION['scriptcase']['saida_html'] = "";
  3694.       } 
  3695.       $nm_saida->saida("        <table class=\"" $this->css_scGridToolbar "\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;\" width=\"100%\" valign=\"top\">\r\n");
  3696.       $nm_saida->saida("         <tr> \r\n");
  3697.       $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"left\" width=\"33%\"> \r\n");
  3698.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print"
  3699.       {
  3700.       if (!$this->Ini->SC_Link_View && $this->nmgp_botoes['qsearch'] == "on")
  3701.       {
  3702.           $OPC_cmp = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'])) ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'][0] : "";
  3703.           $OPC_arg = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'])) ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'][1] : "";
  3704.           $OPC_dat = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'])) ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'][2] : "";
  3705.           $nm_saida->saida("           <script type=\"text/javascript\">var change_fast_top = \"\";</script>\r\n");
  3706.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  3707.           {
  3708.               $this->Ini->Arr_result['setVar'][] = array('var' => 'change_fast_top''value' => "");
  3709.           }
  3710.           if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($OPC_cmp))
  3711.           {
  3712.               $OPC_cmp NM_conv_charset($OPC_cmp$_SESSION['scriptcase']['charset'], "UTF-8");
  3713.           }
  3714.           if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($OPC_arg))
  3715.           {
  3716.               $OPC_arg NM_conv_charset($OPC_arg$_SESSION['scriptcase']['charset'], "UTF-8");
  3717.           }
  3718.           if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($OPC_dat))
  3719.           {
  3720.               $OPC_dat NM_conv_charset($OPC_dat$_SESSION['scriptcase']['charset'], "UTF-8");
  3721.           }
  3722.           $nm_saida->saida("          <input type=\"hidden\"  id=\"fast_search_f0_top\" name=\"nmgp_fast_search\" value=\"SC_all_Cmp\">\r\n");
  3723.           $nm_saida->saida("          <input type=\"hidden\" id=\"cond_fast_search_f0_top\" name=\"nmgp_cond_fast_search\" value=\"qp\">\r\n");
  3724.           $nm_saida->saida("          <script type=\"text/javascript\">var scQSInitVal = \"" NM_encode_input($OPC_dat) . "\";</script>\r\n");
  3725.           $nm_saida->saida("          <span id=\"quicksearchph_top\">\r\n");
  3726.           $nm_saida->saida("           <input type=\"text\" id=\"SC_fast_search_top\" class=\"" $this->css_css_toolbar_obj "\" style=\"vertical-align: middle;\" name=\"nmgp_arg_fast_search\" value=\"" NM_encode_input($OPC_dat) . "\" size=\"10\" onChange=\"change_fast_top = 'CH';\" alt=\"{maxLength: 255}\" placeholder=\"" $this->Ini->Nm_lang['lang_othr_qk_watermark'] . "\">\r\n");
  3727.           $nm_saida->saida("           <img style=\"display: none\" id=\"SC_fast_search_close_top\" src=\"" $this->Ini->path_botoes "/" $this->Ini->Img_qs_clean "\" onclick=\"document.getElementById('SC_fast_search_top').value = '__Clear_Fast__'; nm_gp_submit_qsearch('top');\">\r\n");
  3728.           $nm_saida->saida("           <img style=\"display: none\" id=\"SC_fast_search_submit_top\" src=\"" $this->Ini->path_botoes "/" $this->Ini->Img_qs_search "\" onclick=\"nm_gp_submit_qsearch('top');\">\r\n");
  3729.           $nm_saida->saida("          </span>\r\n");
  3730.           $NM_btn true;
  3731.       }
  3732.           $nm_saida->saida("         </td> \r\n");
  3733.           $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"center\" width=\"33%\"> \r\n");
  3734.       if ($this->nmgp_botoes['sel_col'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3735.       {
  3736.       $pos_path strrpos($this->Ini->path_prod"/");
  3737.       $path_fields $this->Ini->root substr($this->Ini->path_prod0$pos_path) . "/conf/fields/";
  3738.               $Cod_Btn nmButtonOutput($this->arr_buttons"bcolumns""scBtnSelCamposShow('" $this->Ini->path_link "grid_new/grid_new_sel_campos.php?path_img=" $this->Ini->path_img_global "&path_btn=" $this->Ini->path_botoes "&path_fields=" $path_fields "&script_case_init=" NM_encode_input($this->Ini->sc_page) . "&script_case_session=" session_id() . "&embbed_groupby=Y&toolbar_pos=top', 'top');""scBtnSelCamposShow('" $this->Ini->path_link "grid_new/grid_new_sel_campos.php?path_img=" $this->Ini->path_img_global "&path_btn=" $this->Ini->path_botoes "&path_fields=" $path_fields "&script_case_init=" NM_encode_input($this->Ini->sc_page) . "&script_case_session=" session_id() . "&embbed_groupby=Y&toolbar_pos=top', 'top');""selcmp_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3739.               $nm_saida->saida("           $Cod_Btn \r\n");
  3740.               $NM_btn true;
  3741.       }
  3742.       if ($this->nmgp_botoes['sort_col'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3743.       {
  3744.           if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  3745.           {
  3746.               $UseAlias =  "N";
  3747.           }
  3748.           elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  3749.           {
  3750.               $UseAlias =  "N";
  3751.           }
  3752.           else
  3753.           {
  3754.               $UseAlias =  "S";
  3755.           }
  3756.               $Cod_Btn nmButtonOutput($this->arr_buttons"bsort""scBtnOrderCamposShow('" $this->Ini->path_link "grid_new/grid_new_order_campos.php?path_img=" $this->Ini->path_img_global "&path_btn=" $this->Ini->path_botoes "&script_case_init=" NM_encode_input($this->Ini->sc_page) . "&script_case_session=" session_id() . "&use_alias=" $UseAlias "&embbed_groupby=Y&toolbar_pos=top', 'top');""scBtnOrderCamposShow('" $this->Ini->path_link "grid_new/grid_new_order_campos.php?path_img=" $this->Ini->path_img_global "&path_btn=" $this->Ini->path_botoes "&script_case_init=" NM_encode_input($this->Ini->sc_page) . "&script_case_session=" session_id() . "&use_alias=" $UseAlias "&embbed_groupby=Y&toolbar_pos=top', 'top');""ordcmp_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3757.               $nm_saida->saida("           $Cod_Btn \r\n");
  3758.               $NM_btn true;
  3759.       }
  3760.       if ($this->nmgp_botoes['group_2'] == "on" && !$this->grid_emb_form)
  3761.       {
  3762.           $nm_saida->saida("           <script type=\"text/javascript\">var sc_itens_btgp_group_2_top = false;</script>\r\n");
  3763.           $Cod_Btn nmButtonOutput($this->arr_buttons"group_group_2""scBtnGrpShow('group_2_top')""scBtnGrpShow('group_2_top')""sc_btgp_btn_group_2_top""""" $this->Ini->Nm_lang['lang_btns_expt_email_title'] . """""absmiddle""""0px"$this->Ini->path_botoes"""" $this->Ini->Nm_lang['lang_btns_expt_email'] . """""""__sc_grp__""text_fontawesomeicon""text_right""""""""""""""");
  3764.           $nm_saida->saida("           $Cod_Btn\r\n");
  3765.           $NM_btn  true;
  3766.           $NM_Gbtn false;
  3767.           $Cod_Btn nmButtonGroupTableOutput($this->arr_buttons"group_group_2"'group_2''top''list''ini');
  3768.           $nm_saida->saida("           $Cod_Btn\r\n");
  3769.           $Cod_Btn nmButtonGroupTableOutput($this->arr_buttons"group_group_2"'group_2''top''list''fim');
  3770.           $nm_saida->saida("           $Cod_Btn\r\n");
  3771.           $nm_saida->saida("           <script type=\"text/javascript\">\r\n");
  3772.           $nm_saida->saida("             if (!sc_itens_btgp_group_2_top) {\r\n");
  3773.           $nm_saida->saida("                 document.getElementById('sc_btgp_btn_group_2_top').style.display='none'; }\r\n");
  3774.           $nm_saida->saida("           </script>\r\n");
  3775.       }
  3776.       if ($this->nmgp_botoes['group_1'] == "on" && !$this->grid_emb_form)
  3777.       {
  3778.           $nm_saida->saida("           <script type=\"text/javascript\">var sc_itens_btgp_group_1_top = false;</script>\r\n");
  3779.           $Cod_Btn nmButtonOutput($this->arr_buttons"group_group_1""scBtnGrpShow('group_1_top')""scBtnGrpShow('group_1_top')""sc_btgp_btn_group_1_top""""" $this->Ini->Nm_lang['lang_btns_expt'] . """""absmiddle""""0px"$this->Ini->path_botoes"""" $this->Ini->Nm_lang['lang_btns_expt'] . """""""__sc_grp__""text_fontawesomeicon""text_right""""""""""""""");
  3780.           $nm_saida->saida("           $Cod_Btn\r\n");
  3781.           $NM_btn  true;
  3782.           $NM_Gbtn false;
  3783.           $Cod_Btn nmButtonGroupTableOutput($this->arr_buttons"group_group_1"'group_1''top''list''ini');
  3784.           $nm_saida->saida("           $Cod_Btn\r\n");
  3785.       if ($this->nmgp_botoes['pdf'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3786.       {
  3787.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
  3788.       $Tem_gb_pdf  "s";
  3789.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total")
  3790.       {
  3791.           $Tem_gb_pdf "n";
  3792.       }
  3793.       $Tem_pdf_res "n";
  3794.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  3795.       {
  3796.           $Tem_pdf_res "s";
  3797.       }
  3798.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  3799.       {
  3800.           $Tem_pdf_res "n";
  3801.       }
  3802.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  3803.               $Cod_Btn nmButtonOutput($this->arr_buttons"bpdf""""""pdf_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_pdf.php?nm_opc=pdf&nm_target=0&nm_cor=cor&papel=8&lpapel=279&apapel=216&orientacao=1&bookmarks=1&largura=1200&conf_larg=S&conf_fonte=10&grafico=XX&sc_ver_93=" "&nm_tem_gb=" $Tem_gb_pdf "&nm_res_cons=" $Tem_pdf_res "&nm_ini_pdf_res=grid,resume&nm_all_modules=grid,resume,chart&nm_label_group=N&nm_all_cab=S&nm_all_label=S&nm_orient_grid=2&password=n&summary_export_columns=S&pdf_zip=N&origem=cons&language=en_us&conf_socor=N&script_case_init=" $this->Ini->sc_page "&app_name=grid_new&KeepThis=true&TB_iframe=true&modal=true""group_1""only_text""text_right""""""""""""""");
  3804.               $nm_saida->saida("           $Cod_Btn \r\n");
  3805.           $nm_saida->saida("            </div>\r\n");
  3806.               $NM_Gbtn true;
  3807.       }
  3808.       if ($this->nmgp_botoes['word'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3809.       {
  3810.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
  3811.           $Tem_word_res "n";
  3812.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  3813.           {
  3814.               $Tem_word_res "s";
  3815.           }
  3816.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  3817.           {
  3818.               $Tem_word_res "n";
  3819.           }
  3820.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  3821.               $Cod_Btn nmButtonOutput($this->arr_buttons"bword""""""word_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_word.php?script_case_init=" $this->Ini->sc_page "&summary_export_columns=S&nm_cor=CO&nm_res_cons=" $Tem_word_res "&nm_ini_word_res=grid,resume&nm_all_modules=grid,resume,chart&password=n&origem=cons&language=en_us&KeepThis=true&TB_iframe=true&modal=true""group_1""only_text""text_right""""""""""""""");
  3822.               $nm_saida->saida("           $Cod_Btn \r\n");
  3823.           $nm_saida->saida("            </div>\r\n");
  3824.               $NM_Gbtn true;
  3825.       }
  3826.       if ($this->nmgp_botoes['xls'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3827.       {
  3828.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
  3829.           $Tem_xls_res "n";
  3830.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  3831.           {
  3832.               $Tem_xls_res "s";
  3833.           }
  3834.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  3835.           {
  3836.               $Tem_xls_res "n";
  3837.           }
  3838.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  3839.               $Cod_Btn nmButtonOutput($this->arr_buttons"bexcel""""""xls_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_xls.php?script_case_init=" $this->Ini->sc_page "&app_name=grid_new&nm_tp_xls=xlsx&nm_tot_xls=S&nm_res_cons=" $Tem_xls_res "&nm_ini_xls_res=grid,resume&nm_all_modules=grid,resume,chart&password=n&summary_export_columns=S&origem=cons&language=en_us&KeepThis=true&TB_iframe=true&modal=true""group_1""only_text""text_right""""""""""""""");
  3840.               $nm_saida->saida("           $Cod_Btn \r\n");
  3841.           $nm_saida->saida("            </div>\r\n");
  3842.               $NM_Gbtn true;
  3843.       }
  3844.       if ($this->nmgp_botoes['xml'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3845.       {
  3846.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
  3847.           $Tem_xml_res "n";
  3848.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  3849.           {
  3850.               $Tem_xml_res "s";
  3851.           }
  3852.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  3853.           {
  3854.               $Tem_xml_res "n";
  3855.           }
  3856.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  3857.               $Cod_Btn nmButtonOutput($this->arr_buttons"bxml""""""xml_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_xml.php?script_case_init=" $this->Ini->sc_page "&summary_export_columns=S&password=n&nm_res_cons=" $Tem_xml_res "&nm_ini_xml_res=grid,resume&nm_all_modules=grid,resume,chart&nm_xml_tag=tag&nm_xml_label=S&language=&origem=cons&KeepThis=true&TB_iframe=true&modal=true""group_1""only_text""text_right""""""""""""""");
  3858.               $nm_saida->saida("           $Cod_Btn \r\n");
  3859.           $nm_saida->saida("            </div>\r\n");
  3860.               $NM_Gbtn true;
  3861.       }
  3862.       if ($this->nmgp_botoes['csv'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3863.       {
  3864.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
  3865.           $Tem_csv_res "n";
  3866.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  3867.           {
  3868.               $Tem_csv_res "s";
  3869.           }
  3870.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  3871.           {
  3872.               $Tem_csv_res "n";
  3873.           }
  3874.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  3875.               $Cod_Btn nmButtonOutput($this->arr_buttons"bcsv""""""csv_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_csv.php?script_case_init=" $this->Ini->sc_page "&summary_export_columns=S&password=n&nm_res_cons=" $Tem_csv_res "&nm_ini_csv_res=grid,resume&nm_all_modules=grid,resume,chart&nm_delim_line=1&nm_delim_col=1&nm_delim_dados=1&nm_label_csv=N&language=&origem=cons&KeepThis=true&TB_iframe=true&modal=true""group_1""only_text""text_right""""""""""""""");
  3876.               $nm_saida->saida("           $Cod_Btn \r\n");
  3877.           $nm_saida->saida("            </div>\r\n");
  3878.               $NM_Gbtn true;
  3879.       }
  3880.       if ($this->nmgp_botoes['rtf'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3881.       {
  3882.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
  3883.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  3884.               $Cod_Btn nmButtonOutput($this->arr_buttons"brtf""nm_gp_rtf_conf();""nm_gp_rtf_conf();""rtf_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""group_1""only_text""text_right""""""""""""""");
  3885.               $nm_saida->saida("           $Cod_Btn \r\n");
  3886.           $nm_saida->saida("            </div>\r\n");
  3887.               $NM_Gbtn true;
  3888.       }
  3889.           if ($NM_Gbtn)
  3890.           {
  3891.                   $nm_saida->saida("           </td></tr><tr><td class=\"scBtnGrpBackground\">\r\n");
  3892.               $NM_Gbtn false;
  3893.           }
  3894.       if ($this->nmgp_botoes['print'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3895.       {
  3896.           $Tem_pdf_res "n";
  3897.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  3898.           {
  3899.               $Tem_pdf_res "s";
  3900.           }
  3901.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  3902.           {
  3903.               $Tem_pdf_res "n";
  3904.           }
  3905.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_1_top = true;</script>\r\n");
  3906.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  3907.               $Cod_Btn nmButtonOutput($this->arr_buttons"bprint""""""print_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_print.php?script_case_init=" $this->Ini->sc_page "&summary_export_columns=S&nm_opc=RC&nm_cor=CO&password=n&language=en_us&nm_page=" NM_encode_input($this->Ini->sc_page) . "&nm_res_cons=" $Tem_pdf_res "&nm_ini_prt_res=grid,resume&nm_all_modules=grid,resume,chart&origem=cons&KeepThis=true&TB_iframe=true&modal=true""group_1""only_text""text_right""""""""""""""");
  3908.               $nm_saida->saida("           $Cod_Btn \r\n");
  3909.           $nm_saida->saida("            </div>\r\n");
  3910.               $NM_Gbtn true;
  3911.       }
  3912.           $Cod_Btn nmButtonGroupTableOutput($this->arr_buttons"group_group_1"'group_1''top''list''fim');
  3913.           $nm_saida->saida("           $Cod_Btn\r\n");
  3914.           $nm_saida->saida("           <script type=\"text/javascript\">\r\n");
  3915.           $nm_saida->saida("             if (!sc_itens_btgp_group_1_top) {\r\n");
  3916.           $nm_saida->saida("                 document.getElementById('sc_btgp_btn_group_1_top').style.display='none'; }\r\n");
  3917.           $nm_saida->saida("           </script>\r\n");
  3918.       }
  3919.       if (is_file($this->Ini->root $this->Ini->path_img_global $this->Ini->Img_sep_grid))
  3920.       {
  3921.           if ($NM_btn)
  3922.           {
  3923.               $NM_btn false;
  3924.               $NM_ult_sep "NM_sep_1";
  3925.               $nm_saida->saida("          <img id=\"NM_sep_1\" src=\"" $this->Ini->path_img_global $this->Ini->Img_sep_grid "\" align=\"absmiddle\" style=\"vertical-align: middle;\">\r\n");
  3926.           }
  3927.       }
  3928.       if (!$this->Ini->SC_Link_View && $this->nmgp_botoes['filter'] == "on"  && !$this->grid_emb_form)
  3929.       {
  3930.            $Cod_Btn nmButtonOutput($this->arr_buttons"bpesquisa""nm_gp_move('busca', '0', 'grid');""nm_gp_move('busca', '0', 'grid');""pesq_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3931.            $nm_saida->saida("           $Cod_Btn \r\n");
  3932.            $NM_btn true;
  3933.       }
  3934.           $nm_saida->saida("         </td> \r\n");
  3935.           $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"right\" width=\"33%\"> \r\n");
  3936.         if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  3937.         {
  3938.           if ($this->nmgp_botoes['summary'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3939.           {
  3940.               $Cod_Btn nmButtonOutput($this->arr_buttons"bresumo""nm_gp_move('resumo', '0');""nm_gp_move('resumo', '0');""res_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3941.               $nm_saida->saida("           $Cod_Btn \r\n");
  3942.                   $NM_btn true;
  3943.           }
  3944.         }
  3945.       if ($this->nmgp_botoes['gridsave'] == "on" && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  3946.       {
  3947.               $Cod_Btn nmButtonOutput($this->arr_buttons"bgridsave""scBtnSaveGridShow('cons', 'Y', 'top');""scBtnSaveGridShow('cons', 'Y', 'top');""save_grid_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3948.               $nm_saida->saida("           $Cod_Btn \r\n");
  3949.               $NM_btn true;
  3950.       }
  3951.           if (is_file("grid_new_help.txt") && !$this->grid_emb_form)
  3952.           {
  3953.              $Arq_WebHelp file("grid_new_help.txt"); 
  3954.              if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
  3955.              {
  3956.                  $Arq_WebHelp[0] = str_replace("\r\n" ""trim($Arq_WebHelp[0]));
  3957.                  $Tmp explode(";"$Arq_WebHelp[0]); 
  3958.                  foreach ($Tmp as $Cada_help)
  3959.                  {
  3960.                      $Tmp1 explode(":"$Cada_help); 
  3961.                      if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "cons" && is_file($this->Ini->root $this->Ini->path_help $Tmp1[1]))
  3962.                      {
  3963.                         $Cod_Btn nmButtonOutput($this->arr_buttons"bhelp""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""help_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3964.                         $nm_saida->saida("           $Cod_Btn \r\n");
  3965.                         $NM_btn true;
  3966.                      }
  3967.                  }
  3968.              }
  3969.           }
  3970.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['b_sair'] || $this->grid_emb_form || $this->grid_emb_form_full || (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['under_dashboard']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['under_dashboard']))
  3971.       {
  3972.          $this->nmgp_botoes['exit'] = "off"
  3973.       }
  3974.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'])
  3975.       {
  3976.          if ($nm_apl_dependente == && $this->nmgp_botoes['exit'] == "on"
  3977.          { 
  3978.             $Cod_Btn nmButtonOutput($this->arr_buttons"bvoltar""document.F5.action='$nm_url_saida'; document.F5.submit();""document.F5.action='$nm_url_saida'; document.F5.submit();""sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3979.             $nm_saida->saida("           $Cod_Btn \r\n");
  3980.             $NM_btn true;
  3981.          } 
  3982.          elseif (!$this->Ini->SC_Link_View && !$this->aba_iframe && $this->nmgp_botoes['exit'] == "on"
  3983.          { 
  3984.             $Cod_Btn nmButtonOutput($this->arr_buttons"bsair""document.F5.action='$nm_url_saida'; document.F5.submit();""document.F5.action='$nm_url_saida'; document.F5.submit();""sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3985.             $nm_saida->saida("           $Cod_Btn \r\n");
  3986.             $NM_btn true;
  3987.          } 
  3988.       }
  3989.       elseif ($this->nmgp_botoes['exit'] == "on")
  3990.       {
  3991.         if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_modal']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_modal'])
  3992.         {
  3993.            $Cod_Btn nmButtonOutput($this->arr_buttons"bvoltar""self.parent.tb_remove()""self.parent.tb_remove()""sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3994.         }
  3995.         else
  3996.         {
  3997.            $Cod_Btn nmButtonOutput($this->arr_buttons"bvoltar""window.close();""window.close();""sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3998.         }
  3999.          $nm_saida->saida("           $Cod_Btn \r\n");
  4000.          $NM_btn true;
  4001.       }
  4002.       }
  4003.       $nm_saida->saida("         </td> \r\n");
  4004.       $nm_saida->saida("        </tr> \r\n");
  4005.       $nm_saida->saida("       </table> \r\n");
  4006.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4007.       { 
  4008.           $this->Ini->Arr_result['setValue'][] = array('field' => 'sc_grid_toobar_top''value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
  4009.           $_SESSION['scriptcase']['saida_html'] = "";
  4010.       } 
  4011.       $nm_saida->saida("      </td> \r\n");
  4012.       $nm_saida->saida("     </tr> \r\n");
  4013.       $nm_saida->saida("      <tr style=\"display: none\">\r\n");
  4014.       $nm_saida->saida("      <td> \r\n");
  4015.       $nm_saida->saida("     </form> \r\n");
  4016.       $nm_saida->saida("      </td> \r\n");
  4017.       $nm_saida->saida("     </tr> \r\n");
  4018.       if (!$NM_btn && isset($NM_ult_sep))
  4019.       {
  4020.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4021.           { 
  4022.               $this->Ini->Arr_result['setDisplay'][] = array('field' => $NM_ult_sep'value' => 'none');
  4023.           } 
  4024.           $nm_saida->saida("     <script language=\"javascript\">\r\n");
  4025.           $nm_saida->saida("        document.getElementById('" $NM_ult_sep "').style.display='none';\r\n");
  4026.           $nm_saida->saida("     </script>\r\n");
  4027.       }
  4028.    }
  4029.    function nmgp_barra_bot_normal()
  4030.    {
  4031.       global 
  4032.              $nm_saida$nm_url_saida$nm_apl_dependente;
  4033.       $NM_btn  false;
  4034.       $NM_Gbtn false;
  4035.       $this->NM_calc_span();
  4036.       $nm_saida->saida("      <tr style=\"display: none\">\r\n");
  4037.       $nm_saida->saida("      <td>\r\n");
  4038.       $nm_saida->saida("      <form id=\"id_F0_bot\" name=\"F0_bot\" method=\"post\" action=\"./\" target=\"_self\"> \r\n");
  4039.       $nm_saida->saida("      <input type=\"text\" id=\"id_sc_truta_f0_bot\" name=\"sc_truta_f0_bot\" value=\"\"/> \r\n");
  4040.       $nm_saida->saida("      <input type=\"hidden\" id=\"script_init_f0_bot\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  4041.       $nm_saida->saida("      <input type=hidden id=\"script_session_f0_bot\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/>\r\n");
  4042.       $nm_saida->saida("      <input type=\"hidden\" id=\"opcao_f0_bot\" name=\"nmgp_opcao\" value=\"muda_qt_linhas\"/> \r\n");
  4043.       $nm_saida->saida("      </td></tr><tr>\r\n");
  4044.       $nm_saida->saida("       <td id=\"sc_grid_toobar_bot\"  class=\"" $this->css_scGridTabelaTd "\" valign=\"top\"> \r\n");
  4045.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4046.       { 
  4047.           $_SESSION['scriptcase']['saida_html'] = "";
  4048.       } 
  4049.       $nm_saida->saida("        <table class=\"" $this->css_scGridToolbar "\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;\" width=\"100%\" valign=\"top\">\r\n");
  4050.       $nm_saida->saida("         <tr> \r\n");
  4051.       $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"left\" width=\"33%\"> \r\n");
  4052.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print"
  4053.       {
  4054.           if (empty($this->nm_grid_sem_reg) && $this->nmgp_botoes['goto'] == "on" && $this->Ini->Apl_paginacao != "FULL" )
  4055.           {
  4056.               $Reg_Page  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'];
  4057.               $Cod_Btn nmButtonOutput($this->arr_buttons"birpara""var rec_nav = ((document.getElementById('rec_f0_bot').value - 1) * " NM_encode_input($Reg_Page) . ") + 1; nm_gp_submit_ajax('muda_rec_linhas', rec_nav);""var rec_nav = ((document.getElementById('rec_f0_bot').value - 1) * " NM_encode_input($Reg_Page) . ") + 1; nm_gp_submit_ajax('muda_rec_linhas', rec_nav);""brec_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4058.               $nm_saida->saida("           $Cod_Btn \r\n");
  4059.               $Page_Atu   ceil($this->nmgp_reg_inicial $Reg_Page);
  4060.               $nm_saida->saida("          <input id=\"rec_f0_bot\" type=\"text\" class=\"" $this->css_css_toolbar_obj "\" name=\"rec\" value=\"" NM_encode_input($Page_Atu) . "\" style=\"width:25px;vertical-align: middle;\"/> \r\n");
  4061.               $NM_btn true;
  4062.           }
  4063.           if (empty($this->nm_grid_sem_reg) && $this->nmgp_botoes['qtline'] == "on" && $this->Ini->Apl_paginacao != "FULL")
  4064.           {
  4065.               $nm_saida->saida("          <span class=\"" $this->css_css_toolbar_obj "\" style=\"border: 0px;vertical-align: middle;\">" $this->Ini->Nm_lang['lang_btns_rows'] . "</span>\r\n");
  4066.               $nm_saida->saida("          <select class=\"" $this->css_css_toolbar_obj "\" style=\"vertical-align: middle;\" id=\"quant_linhas_f0_bot\" name=\"nmgp_quant_linhas\" onchange=\"sc_ind = document.getElementById('quant_linhas_f0_bot').selectedIndex; nm_gp_submit_ajax('muda_qt_linhas', document.getElementById('quant_linhas_f0_bot').options[sc_ind].value);\"> \r\n");
  4067.               $obj_sel = ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] == 10) ? " selected" "";
  4068.               $nm_saida->saida("           <option value=\"10\" " $obj_sel ">10</option>\r\n");
  4069.               $obj_sel = ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] == 20) ? " selected" "";
  4070.               $nm_saida->saida("           <option value=\"20\" " $obj_sel ">20</option>\r\n");
  4071.               $obj_sel = ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] == 50) ? " selected" "";
  4072.               $nm_saida->saida("           <option value=\"50\" " $obj_sel ">50</option>\r\n");
  4073.               $nm_saida->saida("          </select>\r\n");
  4074.               $NM_btn true;
  4075.           }
  4076.           $nm_saida->saida("         </td> \r\n");
  4077.           $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"center\" width=\"33%\"> \r\n");
  4078.           if ($this->nmgp_botoes['first'] == "on" && empty($this->nm_grid_sem_reg) && $this->Ini->Apl_paginacao != "FULL" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']))
  4079.           {
  4080.               if ($this->Rec_ini == 0)
  4081.               {
  4082.                   $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_inicio""nm_gp_submit_rec('ini');""nm_gp_submit_rec('ini');""first_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""disabled""""""only_text""text_right""""""""""""""");
  4083.                   $nm_saida->saida("           $Cod_Btn \r\n");
  4084.               }
  4085.               else
  4086.               {
  4087.                   $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_inicio""nm_gp_submit_rec('ini');""nm_gp_submit_rec('ini');""first_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4088.                   $nm_saida->saida("           $Cod_Btn \r\n");
  4089.               }
  4090.                   $NM_btn true;
  4091.           }
  4092.           if ($this->nmgp_botoes['back'] == "on" && empty($this->nm_grid_sem_reg) && $this->Ini->Apl_paginacao != "FULL" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']))
  4093.           {
  4094.               if ($this->Rec_ini == 0)
  4095.               {
  4096.                   $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_retorna""nm_gp_submit_rec('" $this->Rec_ini "');""nm_gp_submit_rec('" $this->Rec_ini "');""back_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""disabled""""""only_text""text_right""""""""""""""");
  4097.                   $nm_saida->saida("           $Cod_Btn \r\n");
  4098.               }
  4099.               else
  4100.               {
  4101.                   $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_retorna""nm_gp_submit_rec('" $this->Rec_ini "');""nm_gp_submit_rec('" $this->Rec_ini "');""back_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4102.                   $nm_saida->saida("           $Cod_Btn \r\n");
  4103.               }
  4104.                   $NM_btn true;
  4105.           }
  4106.           if (empty($this->nm_grid_sem_reg) && $this->nmgp_botoes['navpage'] == "on" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']) && $this->Ini->Apl_paginacao != "FULL" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] != "all")
  4107.           {
  4108.               $Reg_Page  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'];
  4109.               $Max_link   5;
  4110.               $Mid_link   ceil($Max_link 2);
  4111.               $Corr_link  = (($Max_link 2) == 0) ? 1;
  4112.               $Qtd_Pages  ceil($this->count_ger $Reg_Page);
  4113.               $Page_Atu   ceil($this->nmgp_reg_final $Reg_Page);
  4114.               $Link_ini   1;
  4115.               if ($Page_Atu $Max_link)
  4116.               {
  4117.                   $Link_ini $Page_Atu $Mid_link $Corr_link;
  4118.               }
  4119.               elseif ($Page_Atu $Mid_link)
  4120.               {
  4121.                   $Link_ini $Page_Atu $Mid_link $Corr_link;
  4122.               }
  4123.               if (($Qtd_Pages $Link_ini) < $Max_link)
  4124.               {
  4125.                   $Link_ini = ($Qtd_Pages $Max_link) + 1;
  4126.               }
  4127.               if ($Link_ini 1)
  4128.               {
  4129.                   $Link_ini 1;
  4130.               }
  4131.               for ($x 0$x $Max_link && $Link_ini <= $Qtd_Pages$x++)
  4132.               {
  4133.                   $rec = (($Link_ini 1) * $Reg_Page) + 1;
  4134.                   if ($Link_ini == $Page_Atu)
  4135.                   {
  4136.                       $nm_saida->saida("            <span class=\"scGridToolbarNavOpen\" style=\"vertical-align: middle;\">" $Link_ini "</span>\r\n");
  4137.                   }
  4138.                   else
  4139.                   {
  4140.                       $nm_saida->saida("            <a class=\"scGridToolbarNav\" style=\"vertical-align: middle;\" href=\"javascript: nm_gp_submit_rec(" $rec ");\">" $Link_ini "</a>\r\n");
  4141.                   }
  4142.                   $Link_ini++;
  4143.                   if (($x 1) < $Max_link && $Link_ini <= $Qtd_Pages && '' != $this->Ini->Str_toolbarnav_separator && @is_file($this->Ini->root $this->Ini->path_img_global $this->Ini->Str_toolbarnav_separator))
  4144.                   {
  4145.                       $nm_saida->saida("            <img src=\"" $this->Ini->path_img_global $this->Ini->Str_toolbarnav_separator "\" align=\"absmiddle\" style=\"vertical-align: middle;\">\r\n");
  4146.                   }
  4147.               }
  4148.               $NM_btn true;
  4149.           }
  4150.           if ($this->nmgp_botoes['forward'] == "on" && empty($this->nm_grid_sem_reg) && $this->Ini->Apl_paginacao != "FULL" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']))
  4151.           {
  4152.               $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_avanca""nm_gp_submit_rec('" $this->Rec_fim "');""nm_gp_submit_rec('" $this->Rec_fim "');""forward_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4153.               $nm_saida->saida("           $Cod_Btn \r\n");
  4154.               $NM_btn true;
  4155.           }
  4156.           if ($this->nmgp_botoes['last'] == "on" && empty($this->nm_grid_sem_reg) && $this->Ini->Apl_paginacao != "FULL" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']))
  4157.           {
  4158.               $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_final""nm_gp_submit_rec('fim');""nm_gp_submit_rec('fim');""last_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4159.               $nm_saida->saida("           $Cod_Btn \r\n");
  4160.               $NM_btn true;
  4161.           }
  4162.           $nm_saida->saida("         </td> \r\n");
  4163.           $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"right\" width=\"33%\"> \r\n");
  4164.           if ($this->nmgp_botoes['rows'] == "on" && empty($this->nm_grid_sem_reg))
  4165.           {
  4166.               $nm_sumario "[" $this->Ini->Nm_lang['lang_othr_smry_info'] . "]";
  4167.               $nm_sumario str_replace("?start?"$this->nmgp_reg_inicial$nm_sumario);
  4168.               if ($this->Ini->Apl_paginacao == "FULL")
  4169.               {
  4170.                   $nm_sumario str_replace("?final?"$this->count_ger$nm_sumario);
  4171.               }
  4172.               else
  4173.               {
  4174.                   $nm_sumario str_replace("?final?"$this->nmgp_reg_final$nm_sumario);
  4175.               }
  4176.               $nm_sumario str_replace("?total?"$this->count_ger$nm_sumario);
  4177.               $nm_saida->saida("           <span class=\"" $this->css_css_toolbar_obj "\" style=\"border:0px;\">" $nm_sumario "</span>\r\n");
  4178.               $NM_btn true;
  4179.           }
  4180.           if (is_file("grid_new_help.txt") && !$this->grid_emb_form)
  4181.           {
  4182.              $Arq_WebHelp file("grid_new_help.txt"); 
  4183.              if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
  4184.              {
  4185.                  $Arq_WebHelp[0] = str_replace("\r\n" ""trim($Arq_WebHelp[0]));
  4186.                  $Tmp explode(";"$Arq_WebHelp[0]); 
  4187.                  foreach ($Tmp as $Cada_help)
  4188.                  {
  4189.                      $Tmp1 explode(":"$Cada_help); 
  4190.                      if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "cons" && is_file($this->Ini->root $this->Ini->path_help $Tmp1[1]))
  4191.                      {
  4192.                         $Cod_Btn nmButtonOutput($this->arr_buttons"bhelp""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""help_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4193.                         $nm_saida->saida("           $Cod_Btn \r\n");
  4194.                         $NM_btn true;
  4195.                      }
  4196.                  }
  4197.              }
  4198.           }
  4199.       }
  4200.       $nm_saida->saida("         </td> \r\n");
  4201.       $nm_saida->saida("        </tr> \r\n");
  4202.       $nm_saida->saida("       </table> \r\n");
  4203.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4204.       { 
  4205.           $this->Ini->Arr_result['setValue'][] = array('field' => 'sc_grid_toobar_bot''value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
  4206.           $_SESSION['scriptcase']['saida_html'] = "";
  4207.       } 
  4208.       $nm_saida->saida("      </td> \r\n");
  4209.       $nm_saida->saida("     </tr> \r\n");
  4210.       $nm_saida->saida("      <tr style=\"display: none\">\r\n");
  4211.       $nm_saida->saida("      <td> \r\n");
  4212.       $nm_saida->saida("     </form> \r\n");
  4213.       $nm_saida->saida("      </td> \r\n");
  4214.       $nm_saida->saida("     </tr> \r\n");
  4215.       if (!$NM_btn && isset($NM_ult_sep))
  4216.       {
  4217.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4218.           { 
  4219.               $this->Ini->Arr_result['setDisplay'][] = array('field' => $NM_ult_sep'value' => 'none');
  4220.           } 
  4221.           $nm_saida->saida("     <script language=\"javascript\">\r\n");
  4222.           $nm_saida->saida("        document.getElementById('" $NM_ult_sep "').style.display='none';\r\n");
  4223.           $nm_saida->saida("     </script>\r\n");
  4224.       }
  4225.    }
  4226.    function nmgp_barra_top_mobile()
  4227.    {
  4228.       global 
  4229.              $nm_saida$nm_url_saida$nm_apl_dependente;
  4230.       $NM_btn  false;
  4231.       $NM_Gbtn false;
  4232.       $nm_saida->saida("      <tr style=\"display: none\">\r\n");
  4233.       $nm_saida->saida("      <td>\r\n");
  4234.       $nm_saida->saida("      <form id=\"id_F0_top\" name=\"F0_top\" method=\"post\" action=\"./\" target=\"_self\"> \r\n");
  4235.       $nm_saida->saida("      <input type=\"text\" id=\"id_sc_truta_f0_top\" name=\"sc_truta_f0_top\" value=\"\"/> \r\n");
  4236.       $nm_saida->saida("      <input type=\"hidden\" id=\"script_init_f0_top\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  4237.       $nm_saida->saida("      <input type=hidden id=\"script_session_f0_top\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/>\r\n");
  4238.       $nm_saida->saida("      <input type=\"hidden\" id=\"opcao_f0_top\" name=\"nmgp_opcao\" value=\"muda_qt_linhas\"/> \r\n");
  4239.       $nm_saida->saida("      </td></tr><tr>\r\n");
  4240.       $nm_saida->saida("       <td id=\"sc_grid_toobar_top\"  class=\"" $this->css_scGridTabelaTd "\" valign=\"top\"> \r\n");
  4241.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4242.       { 
  4243.           $_SESSION['scriptcase']['saida_html'] = "";
  4244.       } 
  4245.       $nm_saida->saida("        <table class=\"" $this->css_scGridToolbar "\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;\" width=\"100%\" valign=\"top\">\r\n");
  4246.       $nm_saida->saida("         <tr> \r\n");
  4247.       $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"left\" width=\"33%\"> \r\n");
  4248.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print"
  4249.       {
  4250.       if (!$this->Ini->SC_Link_View && $this->nmgp_botoes['qsearch'] == "on")
  4251.       {
  4252.           $OPC_cmp = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'])) ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'][0] : "";
  4253.           $OPC_arg = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'])) ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'][1] : "";
  4254.           $OPC_dat = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'])) ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'][2] : "";
  4255.           $nm_saida->saida("           <script type=\"text/javascript\">var change_fast_top = \"\";</script>\r\n");
  4256.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4257.           {
  4258.               $this->Ini->Arr_result['setVar'][] = array('var' => 'change_fast_top''value' => "");
  4259.           }
  4260.           if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($OPC_cmp))
  4261.           {
  4262.               $OPC_cmp NM_conv_charset($OPC_cmp$_SESSION['scriptcase']['charset'], "UTF-8");
  4263.           }
  4264.           if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($OPC_arg))
  4265.           {
  4266.               $OPC_arg NM_conv_charset($OPC_arg$_SESSION['scriptcase']['charset'], "UTF-8");
  4267.           }
  4268.           if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($OPC_dat))
  4269.           {
  4270.               $OPC_dat NM_conv_charset($OPC_dat$_SESSION['scriptcase']['charset'], "UTF-8");
  4271.           }
  4272.           $nm_saida->saida("          <input type=\"hidden\"  id=\"fast_search_f0_top\" name=\"nmgp_fast_search\" value=\"SC_all_Cmp\">\r\n");
  4273.           $nm_saida->saida("          <input type=\"hidden\" id=\"cond_fast_search_f0_top\" name=\"nmgp_cond_fast_search\" value=\"qp\">\r\n");
  4274.           $nm_saida->saida("          <script type=\"text/javascript\">var scQSInitVal = \"" NM_encode_input($OPC_dat) . "\";</script>\r\n");
  4275.           $nm_saida->saida("          <span id=\"quicksearchph_top\">\r\n");
  4276.           $nm_saida->saida("           <input type=\"text\" id=\"SC_fast_search_top\" class=\"" $this->css_css_toolbar_obj "\" style=\"vertical-align: middle;\" name=\"nmgp_arg_fast_search\" value=\"" NM_encode_input($OPC_dat) . "\" size=\"10\" onChange=\"change_fast_top = 'CH';\" alt=\"{maxLength: 255}\" placeholder=\"" $this->Ini->Nm_lang['lang_othr_qk_watermark'] . "\">\r\n");
  4277.           $nm_saida->saida("           <img style=\"display: none\" id=\"SC_fast_search_close_top\" src=\"" $this->Ini->path_botoes "/" $this->Ini->Img_qs_clean "\" onclick=\"document.getElementById('SC_fast_search_top').value = '__Clear_Fast__'; nm_gp_submit_qsearch('top');\">\r\n");
  4278.           $nm_saida->saida("           <img style=\"display: none\" id=\"SC_fast_search_submit_top\" src=\"" $this->Ini->path_botoes "/" $this->Ini->Img_qs_search "\" onclick=\"nm_gp_submit_qsearch('top');\">\r\n");
  4279.           $nm_saida->saida("          </span>\r\n");
  4280.           $NM_btn true;
  4281.       }
  4282.           $nm_saida->saida("         </td> \r\n");
  4283.           $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"center\" width=\"33%\"> \r\n");
  4284.       if ($this->nmgp_botoes['sel_col'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4285.       {
  4286.       $pos_path strrpos($this->Ini->path_prod"/");
  4287.       $path_fields $this->Ini->root substr($this->Ini->path_prod0$pos_path) . "/conf/fields/";
  4288.               $Cod_Btn nmButtonOutput($this->arr_buttons"bcolumns""scBtnSelCamposShow('" $this->Ini->path_link "grid_new/grid_new_sel_campos.php?path_img=" $this->Ini->path_img_global "&path_btn=" $this->Ini->path_botoes "&path_fields=" $path_fields "&script_case_init=" NM_encode_input($this->Ini->sc_page) . "&script_case_session=" session_id() . "&embbed_groupby=Y&toolbar_pos=top', 'top');""scBtnSelCamposShow('" $this->Ini->path_link "grid_new/grid_new_sel_campos.php?path_img=" $this->Ini->path_img_global "&path_btn=" $this->Ini->path_botoes "&path_fields=" $path_fields "&script_case_init=" NM_encode_input($this->Ini->sc_page) . "&script_case_session=" session_id() . "&embbed_groupby=Y&toolbar_pos=top', 'top');""selcmp_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4289.               $nm_saida->saida("           $Cod_Btn \r\n");
  4290.               $NM_btn true;
  4291.       }
  4292.       if ($this->nmgp_botoes['sort_col'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4293.       {
  4294.           if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  4295.           {
  4296.               $UseAlias =  "N";
  4297.           }
  4298.           elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  4299.           {
  4300.               $UseAlias =  "N";
  4301.           }
  4302.           else
  4303.           {
  4304.               $UseAlias =  "S";
  4305.           }
  4306.               $Cod_Btn nmButtonOutput($this->arr_buttons"bsort""scBtnOrderCamposShow('" $this->Ini->path_link "grid_new/grid_new_order_campos.php?path_img=" $this->Ini->path_img_global "&path_btn=" $this->Ini->path_botoes "&script_case_init=" NM_encode_input($this->Ini->sc_page) . "&script_case_session=" session_id() . "&use_alias=" $UseAlias "&embbed_groupby=Y&toolbar_pos=top', 'top');""scBtnOrderCamposShow('" $this->Ini->path_link "grid_new/grid_new_order_campos.php?path_img=" $this->Ini->path_img_global "&path_btn=" $this->Ini->path_botoes "&script_case_init=" NM_encode_input($this->Ini->sc_page) . "&script_case_session=" session_id() . "&use_alias=" $UseAlias "&embbed_groupby=Y&toolbar_pos=top', 'top');""ordcmp_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4307.               $nm_saida->saida("           $Cod_Btn \r\n");
  4308.               $NM_btn true;
  4309.       }
  4310.       if ($this->nmgp_botoes['group_4'] == "on" && !$this->grid_emb_form)
  4311.       {
  4312.           $nm_saida->saida("           <script type=\"text/javascript\">var sc_itens_btgp_group_4_top = false;</script>\r\n");
  4313.           $Cod_Btn nmButtonOutput($this->arr_buttons"group_group_4""scBtnGrpShow('group_4_top')""scBtnGrpShow('group_4_top')""sc_btgp_btn_group_4_top""""" $this->Ini->Nm_lang['lang_btns_expt_email_title'] . """""absmiddle""""0px"$this->Ini->path_botoes"""" $this->Ini->Nm_lang['lang_btns_expt_email'] . """""""__sc_grp__""text_fontawesomeicon""text_right""""""""""""""");
  4314.           $nm_saida->saida("           $Cod_Btn\r\n");
  4315.           $NM_btn  true;
  4316.           $NM_Gbtn false;
  4317.           $Cod_Btn nmButtonGroupTableOutput($this->arr_buttons"group_group_4"'group_4''top''list''ini');
  4318.           $nm_saida->saida("           $Cod_Btn\r\n");
  4319.           $Cod_Btn nmButtonGroupTableOutput($this->arr_buttons"group_group_4"'group_4''top''list''fim');
  4320.           $nm_saida->saida("           $Cod_Btn\r\n");
  4321.           $nm_saida->saida("           <script type=\"text/javascript\">\r\n");
  4322.           $nm_saida->saida("             if (!sc_itens_btgp_group_4_top) {\r\n");
  4323.           $nm_saida->saida("                 document.getElementById('sc_btgp_btn_group_4_top').style.display='none'; }\r\n");
  4324.           $nm_saida->saida("           </script>\r\n");
  4325.       }
  4326.       if ($this->nmgp_botoes['group_3'] == "on" && !$this->grid_emb_form)
  4327.       {
  4328.           $nm_saida->saida("           <script type=\"text/javascript\">var sc_itens_btgp_group_3_top = false;</script>\r\n");
  4329.           $Cod_Btn nmButtonOutput($this->arr_buttons"group_group_3""scBtnGrpShow('group_3_top')""scBtnGrpShow('group_3_top')""sc_btgp_btn_group_3_top""""" $this->Ini->Nm_lang['lang_btns_expt'] . """""absmiddle""""0px"$this->Ini->path_botoes"""" $this->Ini->Nm_lang['lang_btns_expt'] . """""""__sc_grp__""text_fontawesomeicon""text_right""""""""""""""");
  4330.           $nm_saida->saida("           $Cod_Btn\r\n");
  4331.           $NM_btn  true;
  4332.           $NM_Gbtn false;
  4333.           $Cod_Btn nmButtonGroupTableOutput($this->arr_buttons"group_group_3"'group_3''top''list''ini');
  4334.           $nm_saida->saida("           $Cod_Btn\r\n");
  4335.       if ($this->nmgp_botoes['pdf'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4336.       {
  4337.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_3_top = true;</script>\r\n");
  4338.       $Tem_gb_pdf  "s";
  4339.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total")
  4340.       {
  4341.           $Tem_gb_pdf "n";
  4342.       }
  4343.       $Tem_pdf_res "n";
  4344.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  4345.       {
  4346.           $Tem_pdf_res "s";
  4347.       }
  4348.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  4349.       {
  4350.           $Tem_pdf_res "n";
  4351.       }
  4352.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  4353.               $Cod_Btn nmButtonOutput($this->arr_buttons"bpdf""""""pdf_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_pdf.php?nm_opc=pdf&nm_target=0&nm_cor=cor&papel=8&lpapel=279&apapel=216&orientacao=1&bookmarks=1&largura=1200&conf_larg=S&conf_fonte=10&grafico=XX&sc_ver_93=" "&nm_tem_gb=" $Tem_gb_pdf "&nm_res_cons=" $Tem_pdf_res "&nm_ini_pdf_res=grid,resume&nm_all_modules=grid,resume,chart&nm_label_group=N&nm_all_cab=S&nm_all_label=S&nm_orient_grid=2&password=n&summary_export_columns=S&pdf_zip=N&origem=cons&language=en_us&conf_socor=N&script_case_init=" $this->Ini->sc_page "&app_name=grid_new&KeepThis=true&TB_iframe=true&modal=true""group_3""only_text""text_right""""""""""""""");
  4354.               $nm_saida->saida("           $Cod_Btn \r\n");
  4355.           $nm_saida->saida("            </div>\r\n");
  4356.               $NM_Gbtn true;
  4357.       }
  4358.       if ($this->nmgp_botoes['word'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4359.       {
  4360.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_3_top = true;</script>\r\n");
  4361.           $Tem_word_res "n";
  4362.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  4363.           {
  4364.               $Tem_word_res "s";
  4365.           }
  4366.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  4367.           {
  4368.               $Tem_word_res "n";
  4369.           }
  4370.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  4371.               $Cod_Btn nmButtonOutput($this->arr_buttons"bword""""""word_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_word.php?script_case_init=" $this->Ini->sc_page "&summary_export_columns=S&nm_cor=CO&nm_res_cons=" $Tem_word_res "&nm_ini_word_res=grid,resume&nm_all_modules=grid,resume,chart&password=n&origem=cons&language=en_us&KeepThis=true&TB_iframe=true&modal=true""group_3""only_text""text_right""""""""""""""");
  4372.               $nm_saida->saida("           $Cod_Btn \r\n");
  4373.           $nm_saida->saida("            </div>\r\n");
  4374.               $NM_Gbtn true;
  4375.       }
  4376.       if ($this->nmgp_botoes['xls'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4377.       {
  4378.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_3_top = true;</script>\r\n");
  4379.           $Tem_xls_res "n";
  4380.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  4381.           {
  4382.               $Tem_xls_res "s";
  4383.           }
  4384.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  4385.           {
  4386.               $Tem_xls_res "n";
  4387.           }
  4388.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  4389.               $Cod_Btn nmButtonOutput($this->arr_buttons"bexcel""""""xls_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_xls.php?script_case_init=" $this->Ini->sc_page "&app_name=grid_new&nm_tp_xls=xlsx&nm_tot_xls=S&nm_res_cons=" $Tem_xls_res "&nm_ini_xls_res=grid,resume&nm_all_modules=grid,resume,chart&password=n&summary_export_columns=S&origem=cons&language=en_us&KeepThis=true&TB_iframe=true&modal=true""group_3""only_text""text_right""""""""""""""");
  4390.               $nm_saida->saida("           $Cod_Btn \r\n");
  4391.           $nm_saida->saida("            </div>\r\n");
  4392.               $NM_Gbtn true;
  4393.       }
  4394.       if ($this->nmgp_botoes['xml'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4395.       {
  4396.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_3_top = true;</script>\r\n");
  4397.           $Tem_xml_res "n";
  4398.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  4399.           {
  4400.               $Tem_xml_res "s";
  4401.           }
  4402.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  4403.           {
  4404.               $Tem_xml_res "n";
  4405.           }
  4406.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  4407.               $Cod_Btn nmButtonOutput($this->arr_buttons"bxml""""""xml_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_xml.php?script_case_init=" $this->Ini->sc_page "&summary_export_columns=S&password=n&nm_res_cons=" $Tem_xml_res "&nm_ini_xml_res=grid,resume&nm_all_modules=grid,resume,chart&nm_xml_tag=tag&nm_xml_label=S&language=&origem=cons&KeepThis=true&TB_iframe=true&modal=true""group_3""only_text""text_right""""""""""""""");
  4408.               $nm_saida->saida("           $Cod_Btn \r\n");
  4409.           $nm_saida->saida("            </div>\r\n");
  4410.               $NM_Gbtn true;
  4411.       }
  4412.       if ($this->nmgp_botoes['csv'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4413.       {
  4414.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_3_top = true;</script>\r\n");
  4415.           $Tem_csv_res "n";
  4416.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  4417.           {
  4418.               $Tem_csv_res "s";
  4419.           }
  4420.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  4421.           {
  4422.               $Tem_csv_res "n";
  4423.           }
  4424.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  4425.               $Cod_Btn nmButtonOutput($this->arr_buttons"bcsv""""""csv_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_csv.php?script_case_init=" $this->Ini->sc_page "&summary_export_columns=S&password=n&nm_res_cons=" $Tem_csv_res "&nm_ini_csv_res=grid,resume&nm_all_modules=grid,resume,chart&nm_delim_line=1&nm_delim_col=1&nm_delim_dados=1&nm_label_csv=N&language=&origem=cons&KeepThis=true&TB_iframe=true&modal=true""group_3""only_text""text_right""""""""""""""");
  4426.               $nm_saida->saida("           $Cod_Btn \r\n");
  4427.           $nm_saida->saida("            </div>\r\n");
  4428.               $NM_Gbtn true;
  4429.       }
  4430.       if ($this->nmgp_botoes['rtf'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4431.       {
  4432.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_3_top = true;</script>\r\n");
  4433.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  4434.               $Cod_Btn nmButtonOutput($this->arr_buttons"brtf""nm_gp_rtf_conf();""nm_gp_rtf_conf();""rtf_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""group_3""only_text""text_right""""""""""""""");
  4435.               $nm_saida->saida("           $Cod_Btn \r\n");
  4436.           $nm_saida->saida("            </div>\r\n");
  4437.               $NM_Gbtn true;
  4438.       }
  4439.           if ($NM_Gbtn)
  4440.           {
  4441.                   $nm_saida->saida("           </td></tr><tr><td class=\"scBtnGrpBackground\">\r\n");
  4442.               $NM_Gbtn false;
  4443.           }
  4444.       if ($this->nmgp_botoes['print'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4445.       {
  4446.           $Tem_pdf_res "n";
  4447.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  4448.           {
  4449.               $Tem_pdf_res "s";
  4450.           }
  4451.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  4452.           {
  4453.               $Tem_pdf_res "n";
  4454.           }
  4455.           $nm_saida->saida("           <script type=\"text/javascript\">sc_itens_btgp_group_3_top = true;</script>\r\n");
  4456.           $nm_saida->saida("            <div class=\"scBtnGrpText scBtnGrpClick\">\r\n");
  4457.               $Cod_Btn nmButtonOutput($this->arr_buttons"bprint""""""print_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""thickbox""" $this->Ini->path_link "grid_new/grid_new_config_print.php?script_case_init=" $this->Ini->sc_page "&summary_export_columns=S&nm_opc=RC&nm_cor=CO&password=n&language=en_us&nm_page=" NM_encode_input($this->Ini->sc_page) . "&nm_res_cons=" $Tem_pdf_res "&nm_ini_prt_res=grid,resume&nm_all_modules=grid,resume,chart&origem=cons&KeepThis=true&TB_iframe=true&modal=true""group_3""only_text""text_right""""""""""""""");
  4458.               $nm_saida->saida("           $Cod_Btn \r\n");
  4459.           $nm_saida->saida("            </div>\r\n");
  4460.               $NM_Gbtn true;
  4461.       }
  4462.           $Cod_Btn nmButtonGroupTableOutput($this->arr_buttons"group_group_3"'group_3''top''list''fim');
  4463.           $nm_saida->saida("           $Cod_Btn\r\n");
  4464.           $nm_saida->saida("           <script type=\"text/javascript\">\r\n");
  4465.           $nm_saida->saida("             if (!sc_itens_btgp_group_3_top) {\r\n");
  4466.           $nm_saida->saida("                 document.getElementById('sc_btgp_btn_group_3_top').style.display='none'; }\r\n");
  4467.           $nm_saida->saida("           </script>\r\n");
  4468.       }
  4469.       if (is_file($this->Ini->root $this->Ini->path_img_global $this->Ini->Img_sep_grid))
  4470.       {
  4471.           if ($NM_btn)
  4472.           {
  4473.               $NM_btn false;
  4474.               $NM_ult_sep "NM_sep_2";
  4475.               $nm_saida->saida("          <img id=\"NM_sep_2\" src=\"" $this->Ini->path_img_global $this->Ini->Img_sep_grid "\" align=\"absmiddle\" style=\"vertical-align: middle;\">\r\n");
  4476.           }
  4477.       }
  4478.       if (!$this->Ini->SC_Link_View && $this->nmgp_botoes['filter'] == "on"  && !$this->grid_emb_form)
  4479.       {
  4480.            $Cod_Btn nmButtonOutput($this->arr_buttons"bpesquisa""nm_gp_move('busca', '0', 'grid');""nm_gp_move('busca', '0', 'grid');""pesq_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4481.            $nm_saida->saida("           $Cod_Btn \r\n");
  4482.            $NM_btn true;
  4483.       }
  4484.           $nm_saida->saida("         </td> \r\n");
  4485.           $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"right\" width=\"33%\"> \r\n");
  4486.         if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] != "sc_free_total")
  4487.         {
  4488.           if ($this->nmgp_botoes['summary'] == "on" && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'] && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4489.           {
  4490.               $Cod_Btn nmButtonOutput($this->arr_buttons"bresumo""nm_gp_move('resumo', '0');""nm_gp_move('resumo', '0');""res_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4491.               $nm_saida->saida("           $Cod_Btn \r\n");
  4492.                   $NM_btn true;
  4493.           }
  4494.         }
  4495.       if ($this->nmgp_botoes['gridsave'] == "on" && empty($this->nm_grid_sem_reg) && !$this->grid_emb_form)
  4496.       {
  4497.               $Cod_Btn nmButtonOutput($this->arr_buttons"bgridsave""scBtnSaveGridShow('cons', 'Y', 'top');""scBtnSaveGridShow('cons', 'Y', 'top');""save_grid_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4498.               $nm_saida->saida("           $Cod_Btn \r\n");
  4499.               $NM_btn true;
  4500.       }
  4501.           if (is_file("grid_new_help.txt") && !$this->grid_emb_form)
  4502.           {
  4503.              $Arq_WebHelp file("grid_new_help.txt"); 
  4504.              if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
  4505.              {
  4506.                  $Arq_WebHelp[0] = str_replace("\r\n" ""trim($Arq_WebHelp[0]));
  4507.                  $Tmp explode(";"$Arq_WebHelp[0]); 
  4508.                  foreach ($Tmp as $Cada_help)
  4509.                  {
  4510.                      $Tmp1 explode(":"$Cada_help); 
  4511.                      if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "cons" && is_file($this->Ini->root $this->Ini->path_help $Tmp1[1]))
  4512.                      {
  4513.                         $Cod_Btn nmButtonOutput($this->arr_buttons"bhelp""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""help_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4514.                         $nm_saida->saida("           $Cod_Btn \r\n");
  4515.                         $NM_btn true;
  4516.                      }
  4517.                  }
  4518.              }
  4519.           }
  4520.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['b_sair'] || $this->grid_emb_form || $this->grid_emb_form_full || (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['under_dashboard']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['under_dashboard']))
  4521.       {
  4522.          $this->nmgp_botoes['exit'] = "off"
  4523.       }
  4524.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_psq'])
  4525.       {
  4526.          if ($nm_apl_dependente == && $this->nmgp_botoes['exit'] == "on"
  4527.          { 
  4528.             $Cod_Btn nmButtonOutput($this->arr_buttons"bvoltar""document.F5.action='$nm_url_saida'; document.F5.submit();""document.F5.action='$nm_url_saida'; document.F5.submit();""sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4529.             $nm_saida->saida("           $Cod_Btn \r\n");
  4530.             $NM_btn true;
  4531.          } 
  4532.          elseif (!$this->Ini->SC_Link_View && !$this->aba_iframe && $this->nmgp_botoes['exit'] == "on"
  4533.          { 
  4534.             $Cod_Btn nmButtonOutput($this->arr_buttons"bsair""document.F5.action='$nm_url_saida'; document.F5.submit();""document.F5.action='$nm_url_saida'; document.F5.submit();""sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4535.             $nm_saida->saida("           $Cod_Btn \r\n");
  4536.             $NM_btn true;
  4537.          } 
  4538.       }
  4539.       elseif ($this->nmgp_botoes['exit'] == "on")
  4540.       {
  4541.         if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_modal']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_modal'])
  4542.         {
  4543.            $Cod_Btn nmButtonOutput($this->arr_buttons"bvoltar""self.parent.tb_remove()""self.parent.tb_remove()""sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4544.         }
  4545.         else
  4546.         {
  4547.            $Cod_Btn nmButtonOutput($this->arr_buttons"bvoltar""window.close();""window.close();""sai_top""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4548.         }
  4549.          $nm_saida->saida("           $Cod_Btn \r\n");
  4550.          $NM_btn true;
  4551.       }
  4552.       }
  4553.       $nm_saida->saida("         </td> \r\n");
  4554.       $nm_saida->saida("        </tr> \r\n");
  4555.       $nm_saida->saida("       </table> \r\n");
  4556.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4557.       { 
  4558.           $this->Ini->Arr_result['setValue'][] = array('field' => 'sc_grid_toobar_top''value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
  4559.           $_SESSION['scriptcase']['saida_html'] = "";
  4560.       } 
  4561.       $nm_saida->saida("      </td> \r\n");
  4562.       $nm_saida->saida("     </tr> \r\n");
  4563.       $nm_saida->saida("      <tr style=\"display: none\">\r\n");
  4564.       $nm_saida->saida("      <td> \r\n");
  4565.       $nm_saida->saida("     </form> \r\n");
  4566.       $nm_saida->saida("      </td> \r\n");
  4567.       $nm_saida->saida("     </tr> \r\n");
  4568.       if (!$NM_btn && isset($NM_ult_sep))
  4569.       {
  4570.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4571.           { 
  4572.               $this->Ini->Arr_result['setDisplay'][] = array('field' => $NM_ult_sep'value' => 'none');
  4573.           } 
  4574.           $nm_saida->saida("     <script language=\"javascript\">\r\n");
  4575.           $nm_saida->saida("        document.getElementById('" $NM_ult_sep "').style.display='none';\r\n");
  4576.           $nm_saida->saida("     </script>\r\n");
  4577.       }
  4578.    }
  4579.    function nmgp_barra_bot_mobile()
  4580.    {
  4581.       global 
  4582.              $nm_saida$nm_url_saida$nm_apl_dependente;
  4583.       $NM_btn  false;
  4584.       $NM_Gbtn false;
  4585.       $this->NM_calc_span();
  4586.       $nm_saida->saida("      <tr style=\"display: none\">\r\n");
  4587.       $nm_saida->saida("      <td>\r\n");
  4588.       $nm_saida->saida("      <form id=\"id_F0_bot\" name=\"F0_bot\" method=\"post\" action=\"./\" target=\"_self\"> \r\n");
  4589.       $nm_saida->saida("      <input type=\"text\" id=\"id_sc_truta_f0_bot\" name=\"sc_truta_f0_bot\" value=\"\"/> \r\n");
  4590.       $nm_saida->saida("      <input type=\"hidden\" id=\"script_init_f0_bot\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  4591.       $nm_saida->saida("      <input type=hidden id=\"script_session_f0_bot\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/>\r\n");
  4592.       $nm_saida->saida("      <input type=\"hidden\" id=\"opcao_f0_bot\" name=\"nmgp_opcao\" value=\"muda_qt_linhas\"/> \r\n");
  4593.       $nm_saida->saida("      </td></tr><tr>\r\n");
  4594.       $nm_saida->saida("       <td id=\"sc_grid_toobar_bot\"  class=\"" $this->css_scGridTabelaTd "\" valign=\"top\"> \r\n");
  4595.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4596.       { 
  4597.           $_SESSION['scriptcase']['saida_html'] = "";
  4598.       } 
  4599.       $nm_saida->saida("        <table class=\"" $this->css_scGridToolbar "\" style=\"padding: 0px; border-spacing: 0px; border-width: 0px; vertical-align: top;\" width=\"100%\" valign=\"top\">\r\n");
  4600.       $nm_saida->saida("         <tr> \r\n");
  4601.       $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"left\" width=\"33%\"> \r\n");
  4602.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] != "print"
  4603.       {
  4604.           if (empty($this->nm_grid_sem_reg) && $this->nmgp_botoes['goto'] == "on" && $this->Ini->Apl_paginacao != "FULL" )
  4605.           {
  4606.               $Reg_Page  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'];
  4607.               $Cod_Btn nmButtonOutput($this->arr_buttons"birpara""var rec_nav = ((document.getElementById('rec_f0_bot').value - 1) * " NM_encode_input($Reg_Page) . ") + 1; nm_gp_submit_ajax('muda_rec_linhas', rec_nav);""var rec_nav = ((document.getElementById('rec_f0_bot').value - 1) * " NM_encode_input($Reg_Page) . ") + 1; nm_gp_submit_ajax('muda_rec_linhas', rec_nav);""brec_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4608.               $nm_saida->saida("           $Cod_Btn \r\n");
  4609.               $Page_Atu   ceil($this->nmgp_reg_inicial $Reg_Page);
  4610.               $nm_saida->saida("          <input id=\"rec_f0_bot\" type=\"text\" class=\"" $this->css_css_toolbar_obj "\" name=\"rec\" value=\"" NM_encode_input($Page_Atu) . "\" style=\"width:25px;vertical-align: middle;\"/> \r\n");
  4611.               $NM_btn true;
  4612.           }
  4613.           if (empty($this->nm_grid_sem_reg) && $this->nmgp_botoes['qtline'] == "on" && $this->Ini->Apl_paginacao != "FULL")
  4614.           {
  4615.               $nm_saida->saida("          <span class=\"" $this->css_css_toolbar_obj "\" style=\"border: 0px;vertical-align: middle;\">" $this->Ini->Nm_lang['lang_btns_rows'] . "</span>\r\n");
  4616.               $nm_saida->saida("          <select class=\"" $this->css_css_toolbar_obj "\" style=\"vertical-align: middle;\" id=\"quant_linhas_f0_bot\" name=\"nmgp_quant_linhas\" onchange=\"sc_ind = document.getElementById('quant_linhas_f0_bot').selectedIndex; nm_gp_submit_ajax('muda_qt_linhas', document.getElementById('quant_linhas_f0_bot').options[sc_ind].value);\"> \r\n");
  4617.               $obj_sel = ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] == 10) ? " selected" "";
  4618.               $nm_saida->saida("           <option value=\"10\" " $obj_sel ">10</option>\r\n");
  4619.               $obj_sel = ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] == 20) ? " selected" "";
  4620.               $nm_saida->saida("           <option value=\"20\" " $obj_sel ">20</option>\r\n");
  4621.               $obj_sel = ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] == 50) ? " selected" "";
  4622.               $nm_saida->saida("           <option value=\"50\" " $obj_sel ">50</option>\r\n");
  4623.               $nm_saida->saida("          </select>\r\n");
  4624.               $NM_btn true;
  4625.           }
  4626.           $nm_saida->saida("         </td> \r\n");
  4627.           $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"center\" width=\"33%\"> \r\n");
  4628.           if ($this->nmgp_botoes['first'] == "on" && empty($this->nm_grid_sem_reg) && $this->Ini->Apl_paginacao != "FULL" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']))
  4629.           {
  4630.               if ($this->Rec_ini == 0)
  4631.               {
  4632.                   $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_inicio""nm_gp_submit_rec('ini');""nm_gp_submit_rec('ini');""first_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""disabled""""""only_text""text_right""""""""""""""");
  4633.                   $nm_saida->saida("           $Cod_Btn \r\n");
  4634.               }
  4635.               else
  4636.               {
  4637.                   $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_inicio""nm_gp_submit_rec('ini');""nm_gp_submit_rec('ini');""first_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4638.                   $nm_saida->saida("           $Cod_Btn \r\n");
  4639.               }
  4640.                   $NM_btn true;
  4641.           }
  4642.           if ($this->nmgp_botoes['back'] == "on" && empty($this->nm_grid_sem_reg) && $this->Ini->Apl_paginacao != "FULL" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']))
  4643.           {
  4644.               if ($this->Rec_ini == 0)
  4645.               {
  4646.                   $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_retorna""nm_gp_submit_rec('" $this->Rec_ini "');""nm_gp_submit_rec('" $this->Rec_ini "');""back_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""disabled""""""only_text""text_right""""""""""""""");
  4647.                   $nm_saida->saida("           $Cod_Btn \r\n");
  4648.               }
  4649.               else
  4650.               {
  4651.                   $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_retorna""nm_gp_submit_rec('" $this->Rec_ini "');""nm_gp_submit_rec('" $this->Rec_ini "');""back_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4652.                   $nm_saida->saida("           $Cod_Btn \r\n");
  4653.               }
  4654.                   $NM_btn true;
  4655.           }
  4656.           if (empty($this->nm_grid_sem_reg) && $this->nmgp_botoes['navpage'] == "on" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']) && $this->Ini->Apl_paginacao != "FULL" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'] != "all")
  4657.           {
  4658.               $Reg_Page  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_lin_grid'];
  4659.               $Max_link   5;
  4660.               $Mid_link   ceil($Max_link 2);
  4661.               $Corr_link  = (($Max_link 2) == 0) ? 1;
  4662.               $Qtd_Pages  ceil($this->count_ger $Reg_Page);
  4663.               $Page_Atu   ceil($this->nmgp_reg_final $Reg_Page);
  4664.               $Link_ini   1;
  4665.               if ($Page_Atu $Max_link)
  4666.               {
  4667.                   $Link_ini $Page_Atu $Mid_link $Corr_link;
  4668.               }
  4669.               elseif ($Page_Atu $Mid_link)
  4670.               {
  4671.                   $Link_ini $Page_Atu $Mid_link $Corr_link;
  4672.               }
  4673.               if (($Qtd_Pages $Link_ini) < $Max_link)
  4674.               {
  4675.                   $Link_ini = ($Qtd_Pages $Max_link) + 1;
  4676.               }
  4677.               if ($Link_ini 1)
  4678.               {
  4679.                   $Link_ini 1;
  4680.               }
  4681.               for ($x 0$x $Max_link && $Link_ini <= $Qtd_Pages$x++)
  4682.               {
  4683.                   $rec = (($Link_ini 1) * $Reg_Page) + 1;
  4684.                   if ($Link_ini == $Page_Atu)
  4685.                   {
  4686.                       $nm_saida->saida("            <span class=\"scGridToolbarNavOpen\" style=\"vertical-align: middle;\">" $Link_ini "</span>\r\n");
  4687.                   }
  4688.                   else
  4689.                   {
  4690.                       $nm_saida->saida("            <a class=\"scGridToolbarNav\" style=\"vertical-align: middle;\" href=\"javascript: nm_gp_submit_rec(" $rec ");\">" $Link_ini "</a>\r\n");
  4691.                   }
  4692.                   $Link_ini++;
  4693.                   if (($x 1) < $Max_link && $Link_ini <= $Qtd_Pages && '' != $this->Ini->Str_toolbarnav_separator && @is_file($this->Ini->root $this->Ini->path_img_global $this->Ini->Str_toolbarnav_separator))
  4694.                   {
  4695.                       $nm_saida->saida("            <img src=\"" $this->Ini->path_img_global $this->Ini->Str_toolbarnav_separator "\" align=\"absmiddle\" style=\"vertical-align: middle;\">\r\n");
  4696.                   }
  4697.               }
  4698.               $NM_btn true;
  4699.           }
  4700.           if ($this->nmgp_botoes['forward'] == "on" && empty($this->nm_grid_sem_reg) && $this->Ini->Apl_paginacao != "FULL" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']))
  4701.           {
  4702.               $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_avanca""nm_gp_submit_rec('" $this->Rec_fim "');""nm_gp_submit_rec('" $this->Rec_fim "');""forward_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4703.               $nm_saida->saida("           $Cod_Btn \r\n");
  4704.               $NM_btn true;
  4705.           }
  4706.           if ($this->nmgp_botoes['last'] == "on" && empty($this->nm_grid_sem_reg) && $this->Ini->Apl_paginacao != "FULL" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']))
  4707.           {
  4708.               $Cod_Btn nmButtonOutput($this->arr_buttons"bcons_final""nm_gp_submit_rec('fim');""nm_gp_submit_rec('fim');""last_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4709.               $nm_saida->saida("           $Cod_Btn \r\n");
  4710.               $NM_btn true;
  4711.           }
  4712.           $nm_saida->saida("         </td> \r\n");
  4713.           $nm_saida->saida("          <td class=\"" $this->css_scGridToolbarPadd "\" nowrap valign=\"middle\" align=\"right\" width=\"33%\"> \r\n");
  4714.           if ($this->nmgp_botoes['rows'] == "on" && empty($this->nm_grid_sem_reg))
  4715.           {
  4716.               $nm_sumario "[" $this->Ini->Nm_lang['lang_othr_smry_info'] . "]";
  4717.               $nm_sumario str_replace("?start?"$this->nmgp_reg_inicial$nm_sumario);
  4718.               if ($this->Ini->Apl_paginacao == "FULL")
  4719.               {
  4720.                   $nm_sumario str_replace("?final?"$this->count_ger$nm_sumario);
  4721.               }
  4722.               else
  4723.               {
  4724.                   $nm_sumario str_replace("?final?"$this->nmgp_reg_final$nm_sumario);
  4725.               }
  4726.               $nm_sumario str_replace("?total?"$this->count_ger$nm_sumario);
  4727.               $nm_saida->saida("           <span class=\"" $this->css_css_toolbar_obj "\" style=\"border:0px;\">" $nm_sumario "</span>\r\n");
  4728.               $NM_btn true;
  4729.           }
  4730.           if (is_file("grid_new_help.txt") && !$this->grid_emb_form)
  4731.           {
  4732.              $Arq_WebHelp file("grid_new_help.txt"); 
  4733.              if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
  4734.              {
  4735.                  $Arq_WebHelp[0] = str_replace("\r\n" ""trim($Arq_WebHelp[0]));
  4736.                  $Tmp explode(";"$Arq_WebHelp[0]); 
  4737.                  foreach ($Tmp as $Cada_help)
  4738.                  {
  4739.                      $Tmp1 explode(":"$Cada_help); 
  4740.                      if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "cons" && is_file($this->Ini->root $this->Ini->path_help $Tmp1[1]))
  4741.                      {
  4742.                         $Cod_Btn nmButtonOutput($this->arr_buttons"bhelp""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""help_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4743.                         $nm_saida->saida("           $Cod_Btn \r\n");
  4744.                         $NM_btn true;
  4745.                      }
  4746.                  }
  4747.              }
  4748.           }
  4749.       }
  4750.       $nm_saida->saida("         </td> \r\n");
  4751.       $nm_saida->saida("        </tr> \r\n");
  4752.       $nm_saida->saida("       </table> \r\n");
  4753.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4754.       { 
  4755.           $this->Ini->Arr_result['setValue'][] = array('field' => 'sc_grid_toobar_bot''value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
  4756.           $_SESSION['scriptcase']['saida_html'] = "";
  4757.       } 
  4758.       $nm_saida->saida("      </td> \r\n");
  4759.       $nm_saida->saida("     </tr> \r\n");
  4760.       $nm_saida->saida("      <tr style=\"display: none\">\r\n");
  4761.       $nm_saida->saida("      <td> \r\n");
  4762.       $nm_saida->saida("     </form> \r\n");
  4763.       $nm_saida->saida("      </td> \r\n");
  4764.       $nm_saida->saida("     </tr> \r\n");
  4765.       if (!$NM_btn && isset($NM_ult_sep))
  4766.       {
  4767.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4768.           { 
  4769.               $this->Ini->Arr_result['setDisplay'][] = array('field' => $NM_ult_sep'value' => 'none');
  4770.           } 
  4771.           $nm_saida->saida("     <script language=\"javascript\">\r\n");
  4772.           $nm_saida->saida("        document.getElementById('" $NM_ult_sep "').style.display='none';\r\n");
  4773.           $nm_saida->saida("     </script>\r\n");
  4774.       }
  4775.    }
  4776.    function nmgp_barra_top()
  4777.    {
  4778.        if(isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])
  4779.        {
  4780.            $this->nmgp_barra_top_mobile();
  4781.        }
  4782.        else
  4783.        {
  4784.            $this->nmgp_barra_top_normal();
  4785.        }
  4786.    }
  4787.    function nmgp_barra_bot()
  4788.    {
  4789.        if(isset($_SESSION['scriptcase']['proc_mobile']) && $_SESSION['scriptcase']['proc_mobile'])
  4790.        {
  4791.            $this->nmgp_barra_bot_mobile();
  4792.        }
  4793.        else
  4794.        {
  4795.            $this->nmgp_barra_bot_normal();
  4796.        }
  4797.    }
  4798.    function nmgp_embbed_placeholder_top()
  4799.    {
  4800.       global $nm_saida;
  4801.       $nm_saida->saida("     <tr id=\"sc_id_save_grid_placeholder_top\" style=\"display: none\">\r\n");
  4802.       $nm_saida->saida("      <td>\r\n");
  4803.       $nm_saida->saida("      </td>\r\n");
  4804.       $nm_saida->saida("     </tr>\r\n");
  4805.       $nm_saida->saida("     <tr id=\"sc_id_groupby_placeholder_top\" style=\"display: none\">\r\n");
  4806.       $nm_saida->saida("      <td>\r\n");
  4807.       $nm_saida->saida("      </td>\r\n");
  4808.       $nm_saida->saida("     </tr>\r\n");
  4809.       $nm_saida->saida("     <tr id=\"sc_id_sel_campos_placeholder_top\" style=\"display: none\">\r\n");
  4810.       $nm_saida->saida("      <td>\r\n");
  4811.       $nm_saida->saida("      </td>\r\n");
  4812.       $nm_saida->saida("     </tr>\r\n");
  4813.       $nm_saida->saida("     <tr id=\"sc_id_export_email_placeholder_top\" style=\"display: none\">\r\n");
  4814.       $nm_saida->saida("      <td>\r\n");
  4815.       $nm_saida->saida("      </td>\r\n");
  4816.       $nm_saida->saida("     </tr>\r\n");
  4817.       $nm_saida->saida("     <tr id=\"sc_id_order_campos_placeholder_top\" style=\"display: none\">\r\n");
  4818.       $nm_saida->saida("      <td>\r\n");
  4819.       $nm_saida->saida("      </td>\r\n");
  4820.       $nm_saida->saida("     </tr>\r\n");
  4821.    }
  4822.    function nmgp_embbed_placeholder_bot()
  4823.    {
  4824.       global $nm_saida;
  4825.       $nm_saida->saida("     <tr id=\"sc_id_save_grid_placeholder_bot\" style=\"display: none\">\r\n");
  4826.       $nm_saida->saida("      <td>\r\n");
  4827.       $nm_saida->saida("      </td>\r\n");
  4828.       $nm_saida->saida("     </tr>\r\n");
  4829.       $nm_saida->saida("     <tr id=\"sc_id_groupby_placeholder_bot\" style=\"display: none\">\r\n");
  4830.       $nm_saida->saida("      <td>\r\n");
  4831.       $nm_saida->saida("      </td>\r\n");
  4832.       $nm_saida->saida("     </tr>\r\n");
  4833.       $nm_saida->saida("     <tr id=\"sc_id_sel_campos_placeholder_bot\" style=\"display: none\">\r\n");
  4834.       $nm_saida->saida("      <td>\r\n");
  4835.       $nm_saida->saida("      </td>\r\n");
  4836.       $nm_saida->saida("     </tr>\r\n");
  4837.       $nm_saida->saida("     <tr id=\"sc_id_export_email_placeholder_bot\" style=\"display: none\">\r\n");
  4838.       $nm_saida->saida("      <td>\r\n");
  4839.       $nm_saida->saida("      </td>\r\n");
  4840.       $nm_saida->saida("     </tr>\r\n");
  4841.       $nm_saida->saida("     <tr id=\"sc_id_order_campos_placeholder_bot\" style=\"display: none\">\r\n");
  4842.       $nm_saida->saida("      <td>\r\n");
  4843.       $nm_saida->saida("      </td>\r\n");
  4844.       $nm_saida->saida("     </tr>\r\n");
  4845.    }
  4846.    function html_grid_search()
  4847.    {
  4848.        global $nm_saida;
  4849.        $this->grid_search_seq 0;
  4850.        $this->grid_search_str "";
  4851.        $this->grid_search_dat = array();
  4852.        $this->grid_search_str "";
  4853.         if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4854.         { 
  4855.            $_SESSION['scriptcase']['saida_html'] = "";
  4856.         } 
  4857.        $tmp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'];
  4858.        $pos strrpos($tmp"##*@@");
  4859.        if ($pos !== false)
  4860.        {
  4861.            $and_or = (substr($tmp, ($pos 5)) == "and") ? $this->Ini->Nm_lang['lang_srch_and_cond'] : $this->Ini->Nm_lang['lang_srch_orr_cond'];
  4862.            $tmp    substr($tmp0$pos);
  4863.            $this->grid_search_str str_replace("##*@@"", " $and_or " "$tmp);
  4864.        }
  4865.        $str_display = empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'])?'none':'';
  4866.        if(!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  4867.        {
  4868.           $nm_saida->saida("   <tr id=\"NM_Grid_Search\" ajax='' style='display:" $str_display "'>\r\n");
  4869.        }
  4870.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'] && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']))
  4871.        { 
  4872.            $_SESSION['scriptcase']['saida_html'] = "";
  4873.            foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'] as $cmp => $def)
  4874.            {
  4875.                $this->Ini->Arr_result['setValue'][] = array('field' => 'grid_search_label_' $cmp'value' => NM_charset_to_utf8(trim($def['descr'])));
  4876.                $this->Ini->Arr_result['setTitle'][] = array('field' => 'grid_search_label_' $cmp'value' => NM_charset_to_utf8(trim($def['hint'])));
  4877.            }
  4878.            $lin_obj $this->grid_search_add_tag();
  4879.            $this->Ini->Arr_result['setValue'][] = array('field' => 'id_grid_search_add_tag''value' => NM_charset_to_utf8($lin_obj));
  4880.            $this->Ini->Arr_result['setValue'][] = array('field' => 'id_grid_search_cmd_str''value' => NM_charset_to_utf8($this->grid_search_str));
  4881.            if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['save_grid']))
  4882.            {
  4883.                return;
  4884.            }
  4885.            else
  4886.            {
  4887.                $this->Ini->Arr_result['setDisplay'][] = array('field' => 'NM_Grid_Search''value' => '');
  4888.            }
  4889.        } 
  4890.            if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['save_grid']))
  4891.            {
  4892.                $str_display = empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']) ? 'none' '';
  4893.                $this->Ini->Arr_result['setDisplay'][] = array('field' => 'NM_Grid_Search''value' => $str_display);
  4894.            }
  4895.        $nm_saida->saida("   <td  valign=\"top\"> \r\n");
  4896.        $nm_saida->saida("   <div id='id_grid_search_cmd_string' class=\"" $this->css_scAppDivMoldura "\" style='cursor:pointer; display:none;' onclick=\"$('#id_grid_search_cmd_string').hide();$('#div_grid_search').show();\"> \r\n");
  4897.              if (is_file($this->Ini->root $this->Ini->path_img_global '/' $this->Ini->App_div_tree_img_exp))
  4898.              {
  4899.        $nm_saida->saida("                             <img id='id_app_div_tree_img_exp' src=\"" $this->Ini->path_img_global "/" $this->Ini->App_div_tree_img_exp "\" border=0 align='absmiddle' class='scGridFilterTagIconExp'>\r\n");
  4900.              }
  4901.        $nm_saida->saida("     <span class=\"" $this->css_scAppDivHeaderText "\">\r\n");
  4902.        $nm_saida->saida("             " $this->Ini->Nm_lang['lang_othr_dynamicsearch_title_outside'] . "\r\n");
  4903.        $nm_saida->saida("     </span>\r\n");
  4904.        $nm_saida->saida("     <span id='id_grid_search_cmd_str' class=\"" $this->css_scAppDivContentText "\">" NM_encode_input(trim($this->grid_search_str)) . "</span>\r\n");
  4905.        $nm_saida->saida("   </div> \r\n");
  4906.        $nm_saida->saida("   <div id=\"div_grid_search\" class=\"" $this->css_scAppDivMoldura " scGridFilterTag\" style='display:;'> \r\n");
  4907.              if (is_file($this->Ini->root $this->Ini->path_img_global '/' $this->Ini->App_div_tree_img_col))
  4908.              {
  4909.        $nm_saida->saida("                             <a href=\"#\" onclick=\"$('#id_grid_search_cmd_string').show();$('#div_grid_search').hide();\" class='scGridFilterTagIconCol'><img id='id_app_div_tree_img_col' src=\"" $this->Ini->path_img_global "/" $this->Ini->App_div_tree_img_col "\" border=0 align='absmiddle' style='vertical-align: middle; margin-right:4px;'></a>\r\n");
  4910.              }
  4911.        $nm_saida->saida("    <div id='icon_grid_search' class='scGridFilterTagIcon'><svg height='1792' viewBox='0 0 1792 1792' width='1792' xmlns='http://www.w3.org/2000/svg'><path d='M1595 295q17 41-14 70l-493 493v742q0 42-39 59-13 5-25 5-27 0-45-19l-256-256q-19-19-19-45v-486l-493-493q-31-29-14-70 17-39 59-39h1280q42 0 59 39z'/></svg></div> \r\n");
  4912.        $nm_saida->saida("    <div id=\"tags_grid_search\" class='scGridFilterTagList'> \r\n");
  4913.        $nm_saida->saida("        <form id= \"id_Fgrid_search\" name=\"Fgrid_search\" method=\"post\" action=\"./\" target=\"_self\"> \r\n");
  4914.        $nm_saida->saida("            <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  4915.        $nm_saida->saida("            <input type=hidden name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/>\r\n");
  4916.        $nm_saida->saida("            <input type=\"hidden\" name=\"nmgp_opcao\" value=\"grid_search\"/> \r\n");
  4917.        $nm_saida->saida("            <input type=\"hidden\" name=\"parm\" value=\"\"/> \r\n");
  4918.             if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']))
  4919.             {
  4920.                 foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'] as $cmp => $def)
  4921.                 {
  4922.                     if (isset($def['label'])) {
  4923.                         $this->grid_search_seq++;
  4924.                         $lin_obj $this->grid_search_tag_ini($cmp$def$this->grid_search_seq);
  4925.                         $nm_saida->saida("" $lin_obj "\r\n");
  4926.                         if ($cmp == "proprietarios_idproprietario")
  4927.                         {
  4928.                            $this->grid_search_dat[$this->grid_search_seq] = "proprietarios_idproprietario";
  4929.                            $lin_obj $this->grid_search_proprietarios_idproprietario($this->grid_search_seq'N'$def['opc'], $def['val'], $def['label']);
  4930.                            $nm_saida->saida("" $lin_obj "\r\n");
  4931.                         }
  4932.                         if ($cmp == "proprietarios_nome")
  4933.                         {
  4934.                            $this->grid_search_dat[$this->grid_search_seq] = "proprietarios_nome";
  4935.                            $lin_obj $this->grid_search_proprietarios_nome($this->grid_search_seq'N'$def['opc'], $def['val'], $def['label']);
  4936.                            $nm_saida->saida("" $lin_obj "\r\n");
  4937.                         }
  4938.                         if ($cmp == "proprietarios_sexo")
  4939.                         {
  4940.                            $this->grid_search_dat[$this->grid_search_seq] = "proprietarios_sexo";
  4941.                            $lin_obj $this->grid_search_proprietarios_sexo($this->grid_search_seq'N'$def['opc'], $def['val'], $def['label']);
  4942.                            $nm_saida->saida("" $lin_obj "\r\n");
  4943.                         }
  4944.                         if ($cmp == "proprietarios_cpf")
  4945.                         {
  4946.                            $this->grid_search_dat[$this->grid_search_seq] = "proprietarios_cpf";
  4947.                            $lin_obj $this->grid_search_proprietarios_cpf($this->grid_search_seq'N'$def['opc'], $def['val'], $def['label']);
  4948.                            $nm_saida->saida("" $lin_obj "\r\n");
  4949.                         }
  4950.                         $lin_obj $this->grid_search_tag_end();
  4951.                         $nm_saida->saida("" $lin_obj "\r\n");
  4952.                     }
  4953.                 }
  4954.             }
  4955.        $nm_saida->saida("            <div id='add_grid_search' class='scGridFilterTagAdd SC_SubMenuApp' onclick=\"nm_show_advancedsearch_fields();\">\r\n");
  4956.        $nm_saida->saida("                " $this->Ini->Nm_lang['lang_srch_addfields'] . "\r\n");
  4957.        $nm_saida->saida("                <div id='id_grid_search_add_tag' style='position: absolute; border-collapse: collapse; z-index: 1000; display:none;'>\r\n");
  4958.        $lin_obj $this->grid_search_add_tag();
  4959.        $nm_saida->saida("" $lin_obj "\r\n");
  4960.        $nm_saida->saida("                </div>\r\n");
  4961.        $nm_saida->saida("            </div>\r\n");
  4962.        $nm_saida->saida("        </form>\r\n");
  4963.        $nm_saida->saida("    </div>\r\n");
  4964.        $this->NM_fil_ant $this->gera_array_filtros();
  4965.        $strDisplayFilter = (empty($this->NM_fil_ant))?'none':'';
  4966.        $nm_saida->saida("   <div id='save_grid_search' class='scGridFilterTagSave'>\r\n");
  4967.        $nm_saida->saida("    <form name='Fgrid_search_save'>\r\n");
  4968.        $nm_saida->saida("     <span id=\"id_NM_filters_save\" style=\"display: " $strDisplayFilter "\">\r\n");
  4969.        $nm_saida->saida("       <SELECT class=\"scFilterToolbar_obj\" id=\"id_sel_recup_filters\" name=\"sel_recup_filters\" onChange=\"nm_change_grid_search(this)\" size=\"1\">\r\n");
  4970.        $nm_saida->saida("           <option value=\"\"></option>\r\n");
  4971.        $Nome_filter "";
  4972.        foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  4973.        {
  4974.            $Select "";
  4975.            if (isset($this->NM_curr_fil) && $Cada_filter == $this->NM_curr_fil)
  4976.            {
  4977.                $Select "selected";
  4978.            }
  4979.            if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  4980.            {
  4981.                $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  4982.                $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  4983.            }
  4984.            elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  4985.            {
  4986.                $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  4987.                $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  4988.            }
  4989.            if ($Tipo_filter[1] != $Nome_filter)
  4990.            {
  4991.                $Nome_filter $Tipo_filter[1];
  4992.                    $nm_saida->saida("       <option value=''>" NM_encode_input($Nome_filter) . "</option>\r\n");
  4993.            }
  4994.               $nm_saida->saida("        <option value='" NM_encode_input($Tipo_filter[0]) . "' " $Select ">.." $Cada_filter "</option>\r\n");
  4995.        }
  4996.        $nm_saida->saida("       </SELECT>\r\n");
  4997.        $nm_saida->saida("     </span>\r\n");
  4998.        $Cod_Btn nmButtonOutput($this->arr_buttons"bedit_filter_appdiv""document.getElementById('Salvar_filters').style.display = ''; document.Fgrid_search_save.nmgp_save_name.focus()""document.getElementById('Salvar_filters').style.display = ''; document.Fgrid_search_save.nmgp_save_name.focus()""Ativa_save""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4999.        $nm_saida->saida("       $Cod_Btn \r\n");
  5000.        $nm_saida->saida("    <DIV id=\"Salvar_filters\" style=\"display:none;z-index:9999;position: absolute;\">\r\n");
  5001.        $nm_saida->saida("     <TABLE align=\"center\" class=\"scFilterTable\">\r\n");
  5002.        $nm_saida->saida("      <TR>\r\n");
  5003.        $nm_saida->saida("       <TD class=\"scFilterBlock\">\r\n");
  5004.        $nm_saida->saida("        <table style=\"border-width: 0px; border-collapse: collapse\" width=\"100%\">\r\n");
  5005.        $nm_saida->saida("         <tr>\r\n");
  5006.        $nm_saida->saida("          <td style=\"padding: 0px\" valign=\"top\" class=\"scFilterBlockFont\">" $this->Ini->Nm_lang['lang_othr_srch_head'] . "</td>\r\n");
  5007.        $nm_saida->saida("          <td style=\"padding: 0px\" align=\"right\" valign=\"top\">\r\n");
  5008.        $Cod_Btn nmButtonOutput($this->arr_buttons"bcancelar_appdiv""document.getElementById('Salvar_filters').style.display = 'none'""document.getElementById('Salvar_filters').style.display = 'none'""Cancel_frm""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  5009.        $nm_saida->saida("       $Cod_Btn \r\n");
  5010.        $nm_saida->saida("          </td>\r\n");
  5011.        $nm_saida->saida("         </tr>\r\n");
  5012.        $nm_saida->saida("        </table>\r\n");
  5013.        $nm_saida->saida("       </TD>\r\n");
  5014.        $nm_saida->saida("      </TR>\r\n");
  5015.        $nm_saida->saida("      <TR>\r\n");
  5016.        $nm_saida->saida("       <TD class=\"scFilterFieldOdd\">\r\n");
  5017.        $nm_saida->saida("        <table style=\"border-width: 0px; border-collapse: collapse\" width=\"100%\">\r\n");
  5018.        $nm_saida->saida("         <tr>\r\n");
  5019.        $nm_saida->saida("          <td style=\"padding: 0px\" valign=\"top\">\r\n");
  5020.        $nm_saida->saida("           <input class=\"scFilterObjectOdd\" type=\"text\" id=\"SC_nmgp_save_name\" name=\"nmgp_save_name\" value=\"\">\r\n");
  5021.        $nm_saida->saida("          </td>\r\n");
  5022.        $nm_saida->saida("          <td style=\"padding: 0px\" align=\"right\" valign=\"top\">\r\n");
  5023.        $Cod_Btn nmButtonOutput($this->arr_buttons"bsalvar_appdiv""nm_save_grid_search()""nm_save_grid_search()""Save_frm""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  5024.        $nm_saida->saida("       $Cod_Btn \r\n");
  5025.        $nm_saida->saida("          </td>\r\n");
  5026.        $nm_saida->saida("         </tr>\r\n");
  5027.        $nm_saida->saida("        </table>\r\n");
  5028.        $nm_saida->saida("       </TD>\r\n");
  5029.        $nm_saida->saida("      </TR>\r\n");
  5030.        $style_del_filter = (!empty($this->NM_fil_ant)) ? '' 'none';
  5031.        $nm_saida->saida("      <TR>\r\n");
  5032.        $nm_saida->saida("       <TD class=\"scFilterFieldEven\">\r\n");
  5033.        $nm_saida->saida("       <DIV id=\"Apaga_filters\" style=\"display: " $style_del_filter "\">\r\n");
  5034.        $nm_saida->saida("        <table style=\"border-width: 0px; border-collapse: collapse\" width=\"100%\">\r\n");
  5035.        $nm_saida->saida("         <tr>\r\n");
  5036.        $nm_saida->saida("          <td style=\"padding: 0px\" valign=\"top\">\r\n");
  5037.        $nm_saida->saida("          <div id=\"id_sel_filters_del\">\r\n");
  5038.        $nm_saida->saida("           <SELECT class=\"scFilterObjectOdd\" id=\"sel_filters_del\" name=\"NM_filters_del\" size=\"1\">\r\n");
  5039.        $nm_saida->saida("            <option value=\"\"></option>\r\n");
  5040.        $Nome_filter "";
  5041.        foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  5042.        {
  5043.            $Select "";
  5044.            if ($Cada_filter == $this->NM_curr_fil)
  5045.            {
  5046.                $Select "selected";
  5047.            }
  5048.            if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  5049.            {
  5050.                $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  5051.                $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  5052.            }
  5053.            elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  5054.            {
  5055.                $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  5056.                $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  5057.            }
  5058.            if ($Tipo_filter[1] != $Nome_filter)
  5059.            {
  5060.                $Nome_filter $Tipo_filter[1];
  5061.                $nm_saida->saida("           <option value=''>" NM_encode_input($Nome_filter) . "</option>\r\n");
  5062.            }
  5063.           $nm_saida->saida("           <option value='" NM_encode_input($Tipo_filter[0]) . "' " $Select ">.." $Cada_filter "</option>\r\n");
  5064.        }
  5065.        $nm_saida->saida("           </SELECT>\r\n");
  5066.        $nm_saida->saida("          </div>\r\n");
  5067.        $nm_saida->saida("          </td>\r\n");
  5068.        $nm_saida->saida("          <td style=\"padding: 0px\" align=\"right\" valign=\"top\">\r\n");
  5069.        $Cod_Btn nmButtonOutput($this->arr_buttons"bexcluir""nm_del_grid_search()""nm_del_grid_search()""Exc_filtro""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  5070.        $nm_saida->saida("       $Cod_Btn \r\n");
  5071.        $nm_saida->saida("          </td>\r\n");
  5072.        $nm_saida->saida("         </tr>\r\n");
  5073.        $nm_saida->saida("        </table>\r\n");
  5074.        $nm_saida->saida("       </DIV>\r\n");
  5075.        $nm_saida->saida("       </TD>\r\n");
  5076.        $nm_saida->saida("      </TR>\r\n");
  5077.        $nm_saida->saida("     </TABLE>\r\n");
  5078.        $nm_saida->saida("    </DIV> \r\n");
  5079.        $nm_saida->saida("   </form>\r\n");
  5080.        $nm_saida->saida("  </div> \r\n");
  5081.        $nm_saida->saida("    <div id='close_grid_search' class='scGridFilterTagClose' onclick=\"checkLastTag(true);setTimeout(function() {nm_proc_grid_search(0, 'del_grid_search_all', 'grid_search')}, 200);\"></div>\r\n");
  5082.        $nm_saida->saida("   </div>\r\n");
  5083.        $nm_saida->saida("   </td>\r\n");
  5084.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  5085.        { 
  5086.            $this->Ini->Arr_result['setValue'][] = array('field' => 'NM_Grid_Search''value' => NM_charset_to_utf8($_SESSION['scriptcase']['saida_html']));
  5087.            $_SESSION['scriptcase']['saida_html'] = "";
  5088.            if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['save_grid']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']))
  5089.            { 
  5090.                $this->Ini->Arr_result['exec_JS'][] = array('function' => 'SC_carga_evt_jquery_grid''parm' => 'all');
  5091.            } 
  5092.        } 
  5093.        if(!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  5094.        {
  5095.            $nm_saida->saida("   </tr>\r\n");
  5096.        }
  5097.        $this->JS_grid_search();
  5098.    }
  5099.    function grid_search_tag_ini($cmp$def$seq)
  5100.    {
  5101.        global $nm_saida;
  5102.        $lin_obj  "";
  5103.        $lin_obj .= "<div class='scGridFilterTagListItem' id='grid_search_" $cmp "'>";
  5104.        $lin_obj .= "<span class='scGridFilterTagListItemLabel' id='grid_search_label_" $cmp "' title='" NM_encode_input($def['hint']) . "' style='cursor:pointer;' onclick=\"closeAllTags();$('#grid_search_" $cmp " .scGridFilterTagListFilter').toggle();\">" NM_encode_input($def['descr']) . "</span>";
  5105.        $lin_obj .= "<span class='scGridFilterTagListItemClose' onclick=\"$(this).parent().remove();checkLastTag(false);setTimeout(function() {nm_proc_grid_search('" $seq "', 'del_grid_search', 'grid_search'); return false;}, 200); return false;
  5106.     \"></span>";
  5107.        return $lin_obj;
  5108.    }
  5109.    function grid_search_tag_end()
  5110.    {
  5111.        global $nm_saida;
  5112.        $lin_obj  "</div>";
  5113.        return $lin_obj;
  5114.    }
  5115.    function grid_search_add_tag()
  5116.    {
  5117.        $lin_obj  "";
  5118.        $All_cmp_search = array('proprietarios_idproprietario','proprietarios_nome','proprietarios_sexo','proprietarios_cpf');
  5119.        $nmgp_tab_label $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'];
  5120.        if (!empty($nmgp_tab_label))
  5121.        {
  5122.           $nm_tab_campos explode("?@?"$nmgp_tab_label);
  5123.           $nmgp_tab_label = array();
  5124.           foreach ($nm_tab_campos as $cada_campo)
  5125.           {
  5126.               $parte_campo explode("?#?"$cada_campo);
  5127.               $nmgp_tab_label[$parte_campo[0]] = $parte_campo[1];
  5128.           }
  5129.        }
  5130.        if (count($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']) < 4)
  5131.        {
  5132.            $lin_obj .= "<table id='id_grid_search_all_cmp' cellpadding=0 cellspacing=0>";
  5133.            foreach ($All_cmp_search as $cada_cmp)
  5134.            {
  5135.                if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$cada_cmp]))
  5136.                {
  5137.                    $lin_obj .= "  <tr>";
  5138.                    $lin_obj .= "    <td class='scBtnGrpBackground'>";
  5139.                    $lin_obj .= "        <div class='scBtnGrpText' style='cursor:pointer; right:80px;' onClick=\"ajax_add_grid_search(this, 'grid', '" $cada_cmp "'); return false;\">";
  5140.                    $lin_obj .= "            " $nmgp_tab_label[$cada_cmp] . "";
  5141.                    $lin_obj .= "        </div>";
  5142.                    $lin_obj .= "    </td>";
  5143.                    $lin_obj .= "  </tr>";
  5144.                }
  5145.            }
  5146.            $lin_obj .= "</table>";
  5147.        }
  5148.        return $lin_obj;
  5149.    }
  5150.    function grid_search_proprietarios_idproprietario($ind$ajax$opc=""$val=array(), $label='')
  5151.    {
  5152.        $lin_obj  "";
  5153.        $lin_obj .= "     <div class='scGridFilterTagListFilter' id='grid_search_proprietarios_idproprietario_" $ind "' style='display:none'>";
  5154.        $lin_obj .= "         <div class='scGridFilterTagListFilterLabel'>"NM_encode_input($label) ." <span class='scGridFilterTagListFilterLabelClose' onclick='closeAllTags(this);'></span></div>";
  5155.        $lin_obj .= "         <div class='scGridFilterTagListFilterInputs'>";
  5156.        if (empty($opc))
  5157.        {
  5158.            $opc "gt";
  5159.        }
  5160.        $lin_obj .= "       <select id='grid_search_proprietarios_idproprietario_cond_" $ind "' name='cond_grid_search_proprietarios_idproprietario_" $ind "' class='" $this->css_scAppDivToolbarInput "' style='vertical-align: middle;' onChange='grid_search_hide_input(\"proprietarios_idproprietario\", $ind)'>";
  5161.        $selected = ($opc == "gt") ? " selected" "";
  5162.        $lin_obj .= "        <option value='gt'" $selected ">" $this->Ini->Nm_lang['lang_srch_grtr'] . "</option>";
  5163.        $selected = ($opc == "lt") ? " selected" "";
  5164.        $lin_obj .= "        <option value='lt'" $selected ">" $this->Ini->Nm_lang['lang_srch_less'] . "</option>";
  5165.        $selected = ($opc == "eq") ? " selected" "";
  5166.        $lin_obj .= "        <option value='eq'" $selected ">" $this->Ini->Nm_lang['lang_srch_exac'] . "</option>";
  5167.        $lin_obj .= "       </select>";
  5168.        if ($opc == "nu" || $opc == "nn" || $opc == "ep" || $opc == "ne")
  5169.        {
  5170.            $display_in_1 "none";
  5171.        }
  5172.        else
  5173.        {
  5174.            $display_in_1 "''";
  5175.        }
  5176.        $lin_obj .= "       <span id=\"grid_proprietarios_idproprietario_" $ind "\" style=\"display:" $display_in_1 "\">";
  5177.        $val_cmp = (isset($val[0][0])) ? $val[0][0] : "";
  5178.        nmgp_Form_Num_Val($val_cmp$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  5179.        $lin_obj .= "     <input  type=\"text\" class='sc-js-input " $this->css_scAppDivToolbarInput "' id='grid_search_proprietarios_idproprietario_val_" $ind "' name='val_grid_search_proprietarios_idproprietario_" $ind "' value=\"" NM_encode_input($val_cmp) . "\" size=11 alt=\"{datatype: 'decimal', maxLength: 11, precision: 0, decimalSep: '" $_SESSION['scriptcase']['reg_conf']['dec_num'] . "', thousandsSep: '" $_SESSION['scriptcase']['reg_conf']['grup_num'] . "', allowNegative: false, onlyNegative: false, enterTab: false}\">";
  5180.        $lin_obj .= "       </span>";
  5181.        $lin_obj .= "          </div>";
  5182.        $lin_obj .= "          <div class='scGridFilterTagListFilterBar'>";
  5183.        $lin_obj .= nmButtonOutput($this->arr_buttons"bapply_appdiv""closeAllTags();setTimeout(function() {nm_proc_grid_search($ind, 'proc_grid_dearch', 'grid_search')}, 200);""closeAllTags();setTimeout(function() {nm_proc_grid_search($ind, 'proc_grid_dearch', 'grid_search')}, 200);""grid_search_apply_" $ind """""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  5184.        $lin_obj .= "          </div>";
  5185.        $lin_obj .= "      </div>";
  5186.        return $lin_obj;
  5187.    }
  5188.    function grid_search_proprietarios_nome($ind$ajax$opc=""$val=array(), $label='')
  5189.    {
  5190.        $lin_obj  "";
  5191.        $lin_obj .= "     <div class='scGridFilterTagListFilter' id='grid_search_proprietarios_nome_" $ind "' style='display:none'>";
  5192.        $lin_obj .= "         <div class='scGridFilterTagListFilterLabel'>"NM_encode_input($label) ." <span class='scGridFilterTagListFilterLabelClose' onclick='closeAllTags(this);'></span></div>";
  5193.        $lin_obj .= "         <div class='scGridFilterTagListFilterInputs'>";
  5194.        if (empty($opc))
  5195.        {
  5196.            $opc "qp";
  5197.        }
  5198.        $lin_obj .= "       <select id='grid_search_proprietarios_nome_cond_" $ind "' name='cond_grid_search_proprietarios_nome_" $ind "' class='" $this->css_scAppDivToolbarInput "' style='vertical-align: middle;' onChange='grid_search_hide_input(\"proprietarios_nome\", $ind)'>";
  5199.        $selected = ($opc == "qp") ? " selected" "";
  5200.        $lin_obj .= "        <option value='qp'" $selected ">" $this->Ini->Nm_lang['lang_srch_like'] . "</option>";
  5201.        $selected = ($opc == "np") ? " selected" "";
  5202.        $lin_obj .= "        <option value='np'" $selected ">" $this->Ini->Nm_lang['lang_srch_not_like'] . "</option>";
  5203.        $selected = ($opc == "eq") ? " selected" "";
  5204.        $lin_obj .= "        <option value='eq'" $selected ">" $this->Ini->Nm_lang['lang_srch_exac'] . "</option>";
  5205.        $selected = ($opc == "ep") ? " selected" "";
  5206.        $lin_obj .= "        <option value='ep'" $selected ">" $this->Ini->Nm_lang['lang_srch_empty'] . "</option>";
  5207.        $lin_obj .= "       </select>";
  5208.        if ($opc == "nu" || $opc == "nn" || $opc == "ep" || $opc == "ne")
  5209.        {
  5210.            $display_in_1 "none";
  5211.        }
  5212.        else
  5213.        {
  5214.            $display_in_1 "''";
  5215.        }
  5216.        $lin_obj .= "       <span id=\"grid_proprietarios_nome_" $ind "\" style=\"display:" $display_in_1 "\">";
  5217.        $val_cmp = (isset($val[0][0])) ? $val[0][0] : "";
  5218.        $proprietarios_nome $val_cmp;
  5219.        if ($proprietarios_nome != "")
  5220.        {
  5221.        $proprietarios_nome_look substr($this->Db->qstr($proprietarios_nome), 1, -1); 
  5222.        $nmgp_def_dados = array(); 
  5223.        $nm_comando "select distinct Proprietarios.Nome from " $this->Ini->nm_tabela " where Proprietarios.Nome = '$proprietarios_nome_look' order by Proprietarios.Nome"
  5224.        $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  5225.        $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  5226.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  5227.        { 
  5228.           while (!$rs->EOF
  5229.           { 
  5230.             $cmp1 trim($rs->fields[0]);
  5231.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  5232.              $rs->MoveNext(); 
  5233.           } 
  5234.           $rs->Close(); 
  5235.        } 
  5236.        else  
  5237.        {  
  5238.            if  ($ajax == 'N')
  5239.            {  
  5240.               $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  5241.               exit; 
  5242.            } 
  5243.            else
  5244.            {  
  5245.               echo $this->Db->ErrorMsg(); 
  5246.            } 
  5247.        } 
  5248.        }
  5249.        if (isset($nmgp_def_dados[0][$proprietarios_nome]))
  5250.        {
  5251.            $sAutocompValue $nmgp_def_dados[0][$proprietarios_nome];
  5252.        }
  5253.        else
  5254.        {
  5255.            $sAutocompValue $val_cmp;
  5256.            $val[0][0]      = $val_cmp;
  5257.        }
  5258.        $val_cmp = (isset($val[0][0])) ? $val[0][0] : "";
  5259.        $lin_obj .= "     <input  type=\"text\" class='sc-js-input " $this->css_scAppDivToolbarInput "' id='grid_search_proprietarios_nome_val_" $ind "' name='val_grid_search_proprietarios_nome_" $ind "' value=\"" NM_encode_input($val_cmp) . "\" size=45 alt=\"{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}\" style='display: none'>";
  5260.        $tmp_pos strpos($val_cmp"##@@");
  5261.        if ($tmp_pos !== false) {
  5262.            $val_cmp substr($val_cmp, ($tmp_pos 4));
  5263.            $sAutocompValue substr($sAutocompValue, ($tmp_pos 4));
  5264.        }
  5265.        $lin_obj .= "     <input class='sc-js-input " $this->css_scAppDivToolbarInput "' type='text' id='id_ac_grid_proprietarios_nome" $ind "' name='val_grid_search_proprietarios_nome_autocomp" $ind "' size='45' value='" NM_encode_input($sAutocompValue) . "' alt=\"{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}\">";
  5266.        $lin_obj .= "       </span>";
  5267.        $lin_obj .= "          </div>";
  5268.        $lin_obj .= "          <div class='scGridFilterTagListFilterBar'>";
  5269.        $lin_obj .= nmButtonOutput($this->arr_buttons"bapply_appdiv""closeAllTags();setTimeout(function() {nm_proc_grid_search($ind, 'proc_grid_dearch', 'grid_search')}, 200);""closeAllTags();setTimeout(function() {nm_proc_grid_search($ind, 'proc_grid_dearch', 'grid_search')}, 200);""grid_search_apply_" $ind """""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  5270.        $lin_obj .= "          </div>";
  5271.        $lin_obj .= "      </div>";
  5272.        return $lin_obj;
  5273.    }
  5274.    function grid_search_proprietarios_sexo($ind$ajax$opc=""$val=array(), $label='')
  5275.    {
  5276.        $lin_obj  "";
  5277.        $lin_obj .= "     <div class='scGridFilterTagListFilter' id='grid_search_proprietarios_sexo_" $ind "' style='display:none'>";
  5278.        $lin_obj .= "         <div class='scGridFilterTagListFilterLabel'>"NM_encode_input($label) ." <span class='scGridFilterTagListFilterLabelClose' onclick='closeAllTags(this);'></span></div>";
  5279.        $lin_obj .= "         <div class='scGridFilterTagListFilterInputs'>";
  5280.        if (empty($opc))
  5281.        {
  5282.            $opc "qp";
  5283.        }
  5284.        $lin_obj .= "       <select id='grid_search_proprietarios_sexo_cond_" $ind "' name='cond_grid_search_proprietarios_sexo_" $ind "' class='" $this->css_scAppDivToolbarInput "' style='vertical-align: middle;' onChange='grid_search_hide_input(\"proprietarios_sexo\", $ind)'>";
  5285.        $selected = ($opc == "qp") ? " selected" "";
  5286.        $lin_obj .= "        <option value='qp'" $selected ">" $this->Ini->Nm_lang['lang_srch_like'] . "</option>";
  5287.        $selected = ($opc == "np") ? " selected" "";
  5288.        $lin_obj .= "        <option value='np'" $selected ">" $this->Ini->Nm_lang['lang_srch_not_like'] . "</option>";
  5289.        $selected = ($opc == "eq") ? " selected" "";
  5290.        $lin_obj .= "        <option value='eq'" $selected ">" $this->Ini->Nm_lang['lang_srch_exac'] . "</option>";
  5291.        $selected = ($opc == "ep") ? " selected" "";
  5292.        $lin_obj .= "        <option value='ep'" $selected ">" $this->Ini->Nm_lang['lang_srch_empty'] . "</option>";
  5293.        $lin_obj .= "       </select>";
  5294.        if ($opc == "nu" || $opc == "nn" || $opc == "ep" || $opc == "ne")
  5295.        {
  5296.            $display_in_1 "none";
  5297.        }
  5298.        else
  5299.        {
  5300.            $display_in_1 "''";
  5301.        }
  5302.        $lin_obj .= "       <span id=\"grid_proprietarios_sexo_" $ind "\" style=\"display:" $display_in_1 "\">";
  5303.        $val_cmp = (isset($val[0][0])) ? $val[0][0] : "";
  5304.        $proprietarios_sexo $val_cmp;
  5305.        if ($proprietarios_sexo != "")
  5306.        {
  5307.        $proprietarios_sexo_look substr($this->Db->qstr($proprietarios_sexo), 1, -1); 
  5308.        $nmgp_def_dados = array(); 
  5309.        $nm_comando "select distinct Proprietarios.Sexo from " $this->Ini->nm_tabela " where Proprietarios.Sexo = '$proprietarios_sexo_look' order by Proprietarios.Sexo"
  5310.        $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  5311.        $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  5312.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  5313.        { 
  5314.           while (!$rs->EOF
  5315.           { 
  5316.             $cmp1 trim($rs->fields[0]);
  5317.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  5318.              $rs->MoveNext(); 
  5319.           } 
  5320.           $rs->Close(); 
  5321.        } 
  5322.        else  
  5323.        {  
  5324.            if  ($ajax == 'N')
  5325.            {  
  5326.               $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  5327.               exit; 
  5328.            } 
  5329.            else
  5330.            {  
  5331.               echo $this->Db->ErrorMsg(); 
  5332.            } 
  5333.        } 
  5334.        }
  5335.        if (isset($nmgp_def_dados[0][$proprietarios_sexo]))
  5336.        {
  5337.            $sAutocompValue $nmgp_def_dados[0][$proprietarios_sexo];
  5338.        }
  5339.        else
  5340.        {
  5341.            $sAutocompValue $val_cmp;
  5342.            $val[0][0]      = $val_cmp;
  5343.        }
  5344.        $val_cmp = (isset($val[0][0])) ? $val[0][0] : "";
  5345.        $lin_obj .= "     <input  type=\"text\" class='sc-js-input " $this->css_scAppDivToolbarInput "' id='grid_search_proprietarios_sexo_val_" $ind "' name='val_grid_search_proprietarios_sexo_" $ind "' value=\"" NM_encode_input($val_cmp) . "\" size=45 alt=\"{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}\" style='display: none'>";
  5346.        $tmp_pos strpos($val_cmp"##@@");
  5347.        if ($tmp_pos !== false) {
  5348.            $val_cmp substr($val_cmp, ($tmp_pos 4));
  5349.            $sAutocompValue substr($sAutocompValue, ($tmp_pos 4));
  5350.        }
  5351.        $lin_obj .= "     <input class='sc-js-input " $this->css_scAppDivToolbarInput "' type='text' id='id_ac_grid_proprietarios_sexo" $ind "' name='val_grid_search_proprietarios_sexo_autocomp" $ind "' size='45' value='" NM_encode_input($sAutocompValue) . "' alt=\"{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}\">";
  5352.        $lin_obj .= "       </span>";
  5353.        $lin_obj .= "          </div>";
  5354.        $lin_obj .= "          <div class='scGridFilterTagListFilterBar'>";
  5355.        $lin_obj .= nmButtonOutput($this->arr_buttons"bapply_appdiv""closeAllTags();setTimeout(function() {nm_proc_grid_search($ind, 'proc_grid_dearch', 'grid_search')}, 200);""closeAllTags();setTimeout(function() {nm_proc_grid_search($ind, 'proc_grid_dearch', 'grid_search')}, 200);""grid_search_apply_" $ind """""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  5356.        $lin_obj .= "          </div>";
  5357.        $lin_obj .= "      </div>";
  5358.        return $lin_obj;
  5359.    }
  5360.    function grid_search_proprietarios_cpf($ind$ajax$opc=""$val=array(), $label='')
  5361.    {
  5362.        $lin_obj  "";
  5363.        $lin_obj .= "     <div class='scGridFilterTagListFilter' id='grid_search_proprietarios_cpf_" $ind "' style='display:none'>";
  5364.        $lin_obj .= "         <div class='scGridFilterTagListFilterLabel'>"NM_encode_input($label) ." <span class='scGridFilterTagListFilterLabelClose' onclick='closeAllTags(this);'></span></div>";
  5365.        $lin_obj .= "         <div class='scGridFilterTagListFilterInputs'>";
  5366.        if (empty($opc))
  5367.        {
  5368.            $opc "gt";
  5369.        }
  5370.        $lin_obj .= "       <select id='grid_search_proprietarios_cpf_cond_" $ind "' name='cond_grid_search_proprietarios_cpf_" $ind "' class='" $this->css_scAppDivToolbarInput "' style='vertical-align: middle;' onChange='grid_search_hide_input(\"proprietarios_cpf\", $ind)'>";
  5371.        $selected = ($opc == "gt") ? " selected" "";
  5372.        $lin_obj .= "        <option value='gt'" $selected ">" $this->Ini->Nm_lang['lang_srch_grtr'] . "</option>";
  5373.        $selected = ($opc == "lt") ? " selected" "";
  5374.        $lin_obj .= "        <option value='lt'" $selected ">" $this->Ini->Nm_lang['lang_srch_less'] . "</option>";
  5375.        $selected = ($opc == "eq") ? " selected" "";
  5376.        $lin_obj .= "        <option value='eq'" $selected ">" $this->Ini->Nm_lang['lang_srch_exac'] . "</option>";
  5377.        $lin_obj .= "       </select>";
  5378.        if ($opc == "nu" || $opc == "nn" || $opc == "ep" || $opc == "ne")
  5379.        {
  5380.            $display_in_1 "none";
  5381.        }
  5382.        else
  5383.        {
  5384.            $display_in_1 "''";
  5385.        }
  5386.        $lin_obj .= "       <span id=\"grid_proprietarios_cpf_" $ind "\" style=\"display:" $display_in_1 "\">";
  5387.        $val_cmp = (isset($val[0][0])) ? $val[0][0] : "";
  5388.        nmgp_Form_Num_Val($val_cmp$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  5389.        $lin_obj .= "     <input  type=\"text\" class='sc-js-input " $this->css_scAppDivToolbarInput "' id='grid_search_proprietarios_cpf_val_" $ind "' name='val_grid_search_proprietarios_cpf_" $ind "' value=\"" NM_encode_input($val_cmp) . "\" size=11 alt=\"{datatype: 'decimal', maxLength: 11, precision: 0, decimalSep: '" $_SESSION['scriptcase']['reg_conf']['dec_num'] . "', thousandsSep: '" $_SESSION['scriptcase']['reg_conf']['grup_num'] . "', allowNegative: false, onlyNegative: false, enterTab: false}\">";
  5390.        $lin_obj .= "       </span>";
  5391.        $lin_obj .= "          </div>";
  5392.        $lin_obj .= "          <div class='scGridFilterTagListFilterBar'>";
  5393.        $lin_obj .= nmButtonOutput($this->arr_buttons"bapply_appdiv""closeAllTags();setTimeout(function() {nm_proc_grid_search($ind, 'proc_grid_dearch', 'grid_search')}, 200);""closeAllTags();setTimeout(function() {nm_proc_grid_search($ind, 'proc_grid_dearch', 'grid_search')}, 200);""grid_search_apply_" $ind """""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  5394.        $lin_obj .= "          </div>";
  5395.        $lin_obj .= "      </div>";
  5396.        return $lin_obj;
  5397.    }
  5398.    function lookup_ajax_proprietarios_nome($proprietarios_nome)
  5399.    {
  5400.        $proprietarios_nome substr($this->Db->qstr($proprietarios_nome), 1, -1);
  5401.        $proprietarios_nome_look substr($this->Db->qstr($proprietarios_nome), 1, -1); 
  5402.        $nmgp_def_dados = array(); 
  5403.        $nm_comando "select distinct Proprietarios.Nome from " $this->Ini->nm_tabela " where  Proprietarios.Nome like '%" $proprietarios_nome "%' order by Proprietarios.Nome"
  5404.        $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  5405.        $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  5406.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  5407.        { 
  5408.           while (!$rs->EOF
  5409.           { 
  5410.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  5411.             $cmp1 grid_new_pack_protect_string($cmp1);
  5412.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  5413.              $rs->MoveNext(); 
  5414.           } 
  5415.           $rs->Close(); 
  5416.           return $nmgp_def_dados
  5417.        } 
  5418.        else  
  5419.        {  
  5420.           echo $this->Db->ErrorMsg(); 
  5421.        } 
  5422.    }
  5423.    function lookup_ajax_proprietarios_sexo($proprietarios_sexo)
  5424.    {
  5425.        $proprietarios_sexo substr($this->Db->qstr($proprietarios_sexo), 1, -1);
  5426.        $proprietarios_sexo_look substr($this->Db->qstr($proprietarios_sexo), 1, -1); 
  5427.        $nmgp_def_dados = array(); 
  5428.        $nm_comando "select distinct Proprietarios.Sexo from " $this->Ini->nm_tabela " where  Proprietarios.Sexo like '%" $proprietarios_sexo "%' order by Proprietarios.Sexo"
  5429.        $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  5430.        $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  5431.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  5432.        { 
  5433.           while (!$rs->EOF
  5434.           { 
  5435.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  5436.             $cmp1 grid_new_pack_protect_string($cmp1);
  5437.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  5438.              $rs->MoveNext(); 
  5439.           } 
  5440.           $rs->Close(); 
  5441.           return $nmgp_def_dados
  5442.        } 
  5443.        else  
  5444.        {  
  5445.           echo $this->Db->ErrorMsg(); 
  5446.        } 
  5447.    }
  5448.    function gera_array_filtros()
  5449.    {
  5450.        $this->NM_fil_ant = array();
  5451.        $pos_path strrpos($this->Ini->path_prod"/");
  5452.        $this->NM_path_filter $this->Ini->root substr($this->Ini->path_prod0$pos_path) . "/conf/filters/";
  5453.        $NM_patch   "Projeto7/grid_new";
  5454.        if (is_dir($this->NM_path_filter $NM_patch))
  5455.        {
  5456.            $NM_dir = @opendir($this->NM_path_filter $NM_patch);
  5457.            while (FALSE !== ($NM_arq = @readdir($NM_dir)))
  5458.            {
  5459.              if (@is_file($this->NM_path_filter $NM_patch "/" $NM_arq))
  5460.              {
  5461.                  $Sc_v6 false;
  5462.                  $NMcmp_filter file($this->NM_path_filter $NM_patch "/" $NM_arq);
  5463.                  $NMcmp_filter explode("@NMF@"$NMcmp_filter[0]);
  5464.                  if (substr($NMcmp_filter[0], 06) == "SC_V6_" || substr($NMcmp_filter[0], 06) == "SC_V8_")
  5465.                  {
  5466.                      $Name_filter substr($NMcmp_filter[0], 6);
  5467.                      if (!empty($Name_filter))
  5468.                      {
  5469.                          $nmgp_save_name str_replace('/'' '$Name_filter);
  5470.                          $nmgp_save_name str_replace('\\'' '$nmgp_save_name);
  5471.                          $nmgp_save_name str_replace('.'' '$nmgp_save_name);
  5472.                          $this->NM_fil_ant[$Name_filter][0] = $NM_patch "/" $nmgp_save_name;
  5473.                          $this->NM_fil_ant[$Name_filter][1] = "" $this->Ini->Nm_lang['lang_srch_public']  . "";
  5474.                          $Sc_v6 true;
  5475.                      }
  5476.                  }
  5477.                  if (!$Sc_v6)
  5478.                  {
  5479.                      $this->NM_fil_ant[$NM_arq][0] = $NM_patch "/" $NM_arq;
  5480.                      $this->NM_fil_ant[$NM_arq][1] = "" $this->Ini->Nm_lang['lang_srch_public']  . "";
  5481.                  }
  5482.              }
  5483.            }
  5484.        }
  5485.        return $this->NM_fil_ant;
  5486.    }
  5487.    function JS_grid_search()
  5488.    {
  5489.        global $nm_saida;
  5490.        $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  5491.        $nm_saida->saida("     var Tot_obj_grid_search = " $this->grid_search_seq ";\r\n");
  5492.        $nm_saida->saida("     Tab_obj_grid_search = new Array();\r\n");
  5493.        $nm_saida->saida("     Tab_evt_grid_search = new Array();\r\n");
  5494.        foreach ($this->grid_search_dat as $seq => $cmp)
  5495.        {
  5496.            $nm_saida->saida("     Tab_obj_grid_search[" $seq "] = '" $cmp "';\r\n");
  5497.        }
  5498.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  5499.        { 
  5500.            $this->Ini->Arr_result['setArr'][] = array('var' => 'Tab_obj_grid_search''value' => '');
  5501.            $this->Ini->Arr_result['setArr'][] = array('var' => 'Tab_evt_grid_search''value' => '');
  5502.            $this->Ini->Arr_result['setVar'][] = array('var' => 'Tot_obj_grid_search''value' => $this->grid_search_seq);
  5503.            foreach ($this->grid_search_dat as $seq => $cmp)
  5504.            {
  5505.                $this->Ini->Arr_result['setVar'][] = array('var' => 'Tab_obj_grid_search[' $seq ']''value' => $cmp);
  5506.            }
  5507.        } 
  5508.        $nm_saida->saida("     function SC_carga_evt_jquery_grid(tp_carga)\r\n");
  5509.        $nm_saida->saida("     {\r\n");
  5510.        $nm_saida->saida("         for (i = 1; i <= Tot_obj_grid_search; i++)\r\n");
  5511.        $nm_saida->saida("         {\r\n");
  5512.        $nm_saida->saida("             if (Tab_obj_grid_search[i] != 'NMSC_Grid_Null' && (tp_carga == 'all' || tp_carga == i))\r\n");
  5513.        $nm_saida->saida("             {\r\n");
  5514.        $nm_saida->saida("                 x   = 0;\r\n");
  5515.        $nm_saida->saida("                 tmp = Tab_obj_grid_search[i];\r\n");
  5516.        $nm_saida->saida("                 cps = new Array();\r\n");
  5517.        $nm_saida->saida("                 cps[x] = tmp;\r\n");
  5518.        $nm_saida->saida("                 for (x = 0; x < cps.length ; x++)\r\n");
  5519.        $nm_saida->saida("                 {\r\n");
  5520.        $nm_saida->saida("                     cmp = cps[x];\r\n");
  5521.        $nm_saida->saida("                     if (Tab_evt_grid_search[cmp])\r\n");
  5522.        $nm_saida->saida("                     {\r\n");
  5523.        $nm_saida->saida("                         eval (\"$('#grid_search_\" + cmp + \"_val_\" + i + \"').bind('change', function() {\" + Tab_evt_grid_search[cmp] + \"})\");\r\n");
  5524.        $nm_saida->saida("                     }\r\n");
  5525.        $nm_saida->saida("                 }\r\n");
  5526.        $nm_saida->saida("             }\r\n");
  5527.        $nm_saida->saida("         }\r\n");
  5528.        $nm_saida->saida("         for (i = 1; i <= Tot_obj_grid_search; i++)\r\n");
  5529.        $nm_saida->saida("         {\r\n");
  5530.        $nm_saida->saida("             if (Tab_obj_grid_search[i] != 'NMSC_Grid_Null' && (tp_carga == 'all' || tp_carga == i))\r\n");
  5531.        $nm_saida->saida("             {\r\n");
  5532.        $nm_saida->saida("                 tmp = Tab_obj_grid_search[i];\r\n");
  5533.        $nm_saida->saida("                 if (tmp == 'proprietarios_nome')\r\n");
  5534.        $nm_saida->saida("                 {\r\n");
  5535.        $nm_saida->saida("                      var x_proprietarios_nome = i;\r\n");
  5536.        $nm_saida->saida("                      $(\"#id_ac_grid_proprietarios_nome\" + i).autocomplete({\r\n");
  5537.        $nm_saida->saida("                        minLength: 1,\r\n");
  5538.        $nm_saida->saida("                        source: function (request, response) {\r\n");
  5539.        $nm_saida->saida("                        $.ajax({\r\n");
  5540.        $nm_saida->saida("                          url: \"index.php\",\r\n");
  5541.        $nm_saida->saida("                          dataType: \"json\",\r\n");
  5542.        $nm_saida->saida("                          data: {\r\n");
  5543.        $nm_saida->saida("                             q: request.term,\r\n");
  5544.        $nm_saida->saida("                             nmgp_opcao: \"ajax_aut_comp_dyn_search\",\r\n");
  5545.        $nm_saida->saida("                             origem: \"grid\",\r\n");
  5546.        $nm_saida->saida("                             field: \"proprietarios_nome\",\r\n");
  5547.        $nm_saida->saida("                             max_itens: \"10\",\r\n");
  5548.        $nm_saida->saida("                             cod_desc: \"N\",\r\n");
  5549.        $nm_saida->saida("                             script_case_init: " $this->Ini->sc_page "\r\n");
  5550.        $nm_saida->saida("                           },\r\n");
  5551.        $nm_saida->saida("                          success: function (data) {\r\n");
  5552.        $nm_saida->saida("                            if (data == \"ss_time_out\") {\r\n");
  5553.        $nm_saida->saida("                                nm_move();\r\n");
  5554.        $nm_saida->saida("                            }\r\n");
  5555.        $nm_saida->saida("                            response(data);\r\n");
  5556.        $nm_saida->saida("                          }\r\n");
  5557.        $nm_saida->saida("                         });\r\n");
  5558.        $nm_saida->saida("                        },\r\n");
  5559.        $nm_saida->saida("                        select: function (event, ui) {\r\n");
  5560.        $nm_saida->saida("                          $(\"#grid_search_proprietarios_nome_val_\" + x_proprietarios_nome).val(ui.item.value);\r\n");
  5561.        $nm_saida->saida("                          $(this).val(ui.item.label);\r\n");
  5562.        $nm_saida->saida("                          event.preventDefault();\r\n");
  5563.        $nm_saida->saida("                        },\r\n");
  5564.        $nm_saida->saida("                        focus: function (event, ui) {\r\n");
  5565.        $nm_saida->saida("                          $(\"#grid_search_proprietarios_nome_val_\" + x_proprietarios_nome).val(ui.item.value);\r\n");
  5566.        $nm_saida->saida("                          $(this).val(ui.item.label);\r\n");
  5567.        $nm_saida->saida("                          event.preventDefault();\r\n");
  5568.        $nm_saida->saida("                        },\r\n");
  5569.        $nm_saida->saida("                        change: function (event, ui) {\r\n");
  5570.        $nm_saida->saida("                          if (null == ui.item) {\r\n");
  5571.        $nm_saida->saida("                             $(\"#grid_search_proprietarios_nome_val_\" + x_proprietarios_nome).val( $(this).val() );\r\n");
  5572.        $nm_saida->saida("                          }\r\n");
  5573.        $nm_saida->saida("                        }\r\n");
  5574.        $nm_saida->saida("                      });\r\n");
  5575.        $nm_saida->saida("                 }\r\n");
  5576.        $nm_saida->saida("                 if (tmp == 'proprietarios_sexo')\r\n");
  5577.        $nm_saida->saida("                 {\r\n");
  5578.        $nm_saida->saida("                      var x_proprietarios_sexo = i;\r\n");
  5579.        $nm_saida->saida("                      $(\"#id_ac_grid_proprietarios_sexo\" + i).autocomplete({\r\n");
  5580.        $nm_saida->saida("                        minLength: 1,\r\n");
  5581.        $nm_saida->saida("                        source: function (request, response) {\r\n");
  5582.        $nm_saida->saida("                        $.ajax({\r\n");
  5583.        $nm_saida->saida("                          url: \"index.php\",\r\n");
  5584.        $nm_saida->saida("                          dataType: \"json\",\r\n");
  5585.        $nm_saida->saida("                          data: {\r\n");
  5586.        $nm_saida->saida("                             q: request.term,\r\n");
  5587.        $nm_saida->saida("                             nmgp_opcao: \"ajax_aut_comp_dyn_search\",\r\n");
  5588.        $nm_saida->saida("                             origem: \"grid\",\r\n");
  5589.        $nm_saida->saida("                             field: \"proprietarios_sexo\",\r\n");
  5590.        $nm_saida->saida("                             max_itens: \"10\",\r\n");
  5591.        $nm_saida->saida("                             cod_desc: \"N\",\r\n");
  5592.        $nm_saida->saida("                             script_case_init: " $this->Ini->sc_page "\r\n");
  5593.        $nm_saida->saida("                           },\r\n");
  5594.        $nm_saida->saida("                          success: function (data) {\r\n");
  5595.        $nm_saida->saida("                            if (data == \"ss_time_out\") {\r\n");
  5596.        $nm_saida->saida("                                nm_move();\r\n");
  5597.        $nm_saida->saida("                            }\r\n");
  5598.        $nm_saida->saida("                            response(data);\r\n");
  5599.        $nm_saida->saida("                          }\r\n");
  5600.        $nm_saida->saida("                         });\r\n");
  5601.        $nm_saida->saida("                        },\r\n");
  5602.        $nm_saida->saida("                        select: function (event, ui) {\r\n");
  5603.        $nm_saida->saida("                          $(\"#grid_search_proprietarios_sexo_val_\" + x_proprietarios_sexo).val(ui.item.value);\r\n");
  5604.        $nm_saida->saida("                          $(this).val(ui.item.label);\r\n");
  5605.        $nm_saida->saida("                          event.preventDefault();\r\n");
  5606.        $nm_saida->saida("                        },\r\n");
  5607.        $nm_saida->saida("                        focus: function (event, ui) {\r\n");
  5608.        $nm_saida->saida("                          $(\"#grid_search_proprietarios_sexo_val_\" + x_proprietarios_sexo).val(ui.item.value);\r\n");
  5609.        $nm_saida->saida("                          $(this).val(ui.item.label);\r\n");
  5610.        $nm_saida->saida("                          event.preventDefault();\r\n");
  5611.        $nm_saida->saida("                        },\r\n");
  5612.        $nm_saida->saida("                        change: function (event, ui) {\r\n");
  5613.        $nm_saida->saida("                          if (null == ui.item) {\r\n");
  5614.        $nm_saida->saida("                             $(\"#grid_search_proprietarios_sexo_val_\" + x_proprietarios_sexo).val( $(this).val() );\r\n");
  5615.        $nm_saida->saida("                          }\r\n");
  5616.        $nm_saida->saida("                        }\r\n");
  5617.        $nm_saida->saida("                      });\r\n");
  5618.        $nm_saida->saida("                 }\r\n");
  5619.        $nm_saida->saida("             }\r\n");
  5620.        $nm_saida->saida("         }\r\n");
  5621.        $nm_saida->saida("     }\r\n");
  5622.        $nm_saida->saida("     function grid_search_hide_input(field, ind)\r\n");
  5623.        $nm_saida->saida("     {\r\n");
  5624.        $nm_saida->saida("        var index = document.getElementById('grid_search_' + field + '_cond_' + ind).selectedIndex;\r\n");
  5625.        $nm_saida->saida("        var parm  = document.getElementById('grid_search_' + field + '_cond_' + ind).options[index].value;\r\n");
  5626.        $nm_saida->saida("        if (parm == \"nu\" || parm == \"nn\" || parm == \"ep\" || parm == \"ne\")\r\n");
  5627.        $nm_saida->saida("        {\r\n");
  5628.        $nm_saida->saida("            $('#grid_' + field + '_' + ind).css('display','none');\r\n");
  5629.        $nm_saida->saida("        }\r\n");
  5630.        $nm_saida->saida("        else\r\n");
  5631.        $nm_saida->saida("        {\r\n");
  5632.        $nm_saida->saida("            $('#grid_' + field + '_' + ind).css('display','');\r\n");
  5633.        $nm_saida->saida("        }\r\n");
  5634.        $nm_saida->saida("     }\r\n");
  5635.        $nm_saida->saida("     var addfilter_status = 'out';\r\n");
  5636.        $nm_saida->saida("     function nm_show_advancedsearch_fields()\r\n");
  5637.        $nm_saida->saida("     {\r\n");
  5638.        $nm_saida->saida("       var btn_id = 'add_grid_search';\r\n");
  5639.        $nm_saida->saida("       var obj_id = 'id_grid_search_add_tag';\r\n");
  5640.        $nm_saida->saida("       if($('#' + btn_id).offset().left + $('#' + obj_id).width() > $(document).width())\r\n");
  5641.        $nm_saida->saida("       {\r\n");
  5642.        $nm_saida->saida("            $('#' + obj_id).css('margin-left', ( $(document).width() - $('#' + btn_id).offset().left - $('#' + obj_id).width() - 10 ));\r\n");
  5643.        $nm_saida->saida("       }\r\n");
  5644.        $nm_saida->saida("       addfilter_status = 'open';\r\n");
  5645.        $nm_saida->saida("       $('#' + btn_id).mouseout(function() {\r\n");
  5646.        $nm_saida->saida("         setTimeout(function() {\r\n");
  5647.        $nm_saida->saida("           nm_hide_advancedsearch_fields(obj_id);\r\n");
  5648.        $nm_saida->saida("         }, 1000);\r\n");
  5649.        $nm_saida->saida("       });\r\n");
  5650.        $nm_saida->saida("       $('#' + obj_id + ' div').click(function() {\r\n");
  5651.        $nm_saida->saida("         addfilter_status = 'out';\r\n");
  5652.        $nm_saida->saida("         nm_hide_advancedsearch_fields(obj_id);\r\n");
  5653.        $nm_saida->saida("       });\r\n");
  5654.        $nm_saida->saida("       $('#' + obj_id).css({\r\n");
  5655.        $nm_saida->saida("         'left': $('#' + btn_id).left\r\n");
  5656.        $nm_saida->saida("       })\r\n");
  5657.        $nm_saida->saida("       .mouseover(function() {\r\n");
  5658.        $nm_saida->saida("         addfilter_status = 'over';\r\n");
  5659.        $nm_saida->saida("       })\r\n");
  5660.        $nm_saida->saida("       .mouseleave(function() {\r\n");
  5661.        $nm_saida->saida("         addfilter_status = 'out';\r\n");
  5662.        $nm_saida->saida("         setTimeout(function() {\r\n");
  5663.        $nm_saida->saida("           nm_hide_advancedsearch_fields(obj_id);\r\n");
  5664.        $nm_saida->saida("         }, 1000);\r\n");
  5665.        $nm_saida->saida("       })\r\n");
  5666.        $nm_saida->saida("       .show('fast');\r\n");
  5667.        $nm_saida->saida("     }\r\n");
  5668.        $nm_saida->saida("     function nm_hide_advancedsearch_fields(obj_id) {\r\n");
  5669.        $nm_saida->saida("      if ('over' != addfilter_status) {\r\n");
  5670.        $nm_saida->saida("        $('#' + obj_id).hide('fast');\r\n");
  5671.        $nm_saida->saida("      }\r\n");
  5672.        $nm_saida->saida("     }\r\n");
  5673.        $nm_saida->saida("     function closeAllTags(obj)\r\n");
  5674.        $nm_saida->saida("     {\r\n");
  5675.        $nm_saida->saida("         if (obj !== undefined)\r\n");
  5676.        $nm_saida->saida("         {\r\n");
  5677.        $nm_saida->saida("             if($(obj).parent().parent().parent().attr('new') == 'new')\r\n");
  5678.        $nm_saida->saida("             {\r\n");
  5679.        $nm_saida->saida("                 $(obj).parent().parent().parent().find('.scGridFilterTagListItemClose').click();\r\n");
  5680.        $nm_saida->saida("             }\r\n");
  5681.        $nm_saida->saida("         }\r\n");
  5682.        $nm_saida->saida("         $('.scGridFilterTagListFilter').hide();\r\n");
  5683.        $nm_saida->saida("     }\r\n");
  5684.        $nm_saida->saida("     function checkLastTag(bol_force)\r\n");
  5685.        $nm_saida->saida("     {\r\n");
  5686.        $nm_saida->saida("         if(bol_force || $('.scGridFilterTagListItem').length == 0)\r\n");
  5687.        $nm_saida->saida("         {\r\n");
  5688.        $nm_saida->saida("             $('#NM_Grid_Search').remove();\r\n");
  5689.        $nm_saida->saida("         }\r\n");
  5690.        $nm_saida->saida("     }\r\n");
  5691.        $nm_saida->saida("     var nm_empty_data_cond = ['ep','ne','nu','nn'];\r\n");
  5692.        $nm_saida->saida("     function nm_proc_grid_search(Seq, Tp_Proc, Origem)\r\n");
  5693.        $nm_saida->saida("     {\r\n");
  5694.        $nm_saida->saida("         var out_dyn = \"\";\r\n");
  5695.        $nm_saida->saida("         var i       = Seq;\r\n");
  5696.        $nm_saida->saida("         if (Tp_Proc == 'del_grid_search' || Tp_Proc == 'del_grid_search_all')\r\n");
  5697.        $nm_saida->saida("         {\r\n");
  5698.        $nm_saida->saida("             $('#add_grid_search').removeClass('scGridFilterTagAddDisabled');\r\n");
  5699.        $nm_saida->saida("             out_dyn += Tab_obj_grid_search[i] + \"_DYN_\" + Tp_Proc;\r\n");
  5700.        $nm_saida->saida("             if (Tp_Proc == 'del_grid_search_all')\r\n");
  5701.        $nm_saida->saida("             {\r\n");
  5702.        $nm_saida->saida("                 Tab_obj_grid_search = new Array();\r\n");
  5703.        $nm_saida->saida("                 checkLastTag(true);\r\n");
  5704.        $nm_saida->saida("             }\r\n");
  5705.        $nm_saida->saida("             else\r\n");
  5706.        $nm_saida->saida("             {\r\n");
  5707.        $nm_saida->saida("                 Tab_obj_grid_search[i] = 'NMSC_Grid_Null';\r\n");
  5708.        $nm_saida->saida("                 eval('Dropdownchecklist_'+ Tab_obj_grid_search[i] +'=false;');\r\n");
  5709.        $nm_saida->saida("             }\r\n");
  5710.        $nm_saida->saida("         }\r\n");
  5711.        $nm_saida->saida("         else\r\n");
  5712.        $nm_saida->saida("         {\r\n");
  5713.        $nm_saida->saida("             $('#grid_search_' + Tab_obj_grid_search[i]).attr('new', '');\r\n");
  5714.        $nm_saida->saida("             if (Tab_obj_grid_search[i] != 'NMSC_Grid_Null')\r\n");
  5715.        $nm_saida->saida("             {\r\n");
  5716.        $nm_saida->saida("                 out_dyn += Tab_obj_grid_search[i];\r\n");
  5717.        $nm_saida->saida("                 obj_dyn  = 'grid_search_' + Tab_obj_grid_search[i] + '_cond_' + i;\r\n");
  5718.        $nm_saida->saida("                 out_cond = grid_search_get_sel_cond(obj_dyn);\r\n");
  5719.        $nm_saida->saida("                 out_dyn += \"_DYN_\" + out_cond;\r\n");
  5720.        $nm_saida->saida("                 obj_dyn  = 'grid_search_' + Tab_obj_grid_search[i] + '_val_';\r\n");
  5721.        $nm_saida->saida("                 if (Tab_obj_grid_search[i] == 'proprietarios_idproprietario')\r\n");
  5722.        $nm_saida->saida("                 {\r\n");
  5723.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, '');\r\n");
  5724.        $nm_saida->saida("                 }\r\n");
  5725.        $nm_saida->saida("                 if (Tab_obj_grid_search[i] == 'proprietarios_nome')\r\n");
  5726.        $nm_saida->saida("                 {\r\n");
  5727.        $nm_saida->saida("                     obj_ac  = 'id_ac_grid_' + Tab_obj_grid_search[i] + i;\r\n");
  5728.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, obj_ac);\r\n");
  5729.        $nm_saida->saida("                 }\r\n");
  5730.        $nm_saida->saida("                 if (Tab_obj_grid_search[i] == 'proprietarios_sexo')\r\n");
  5731.        $nm_saida->saida("                 {\r\n");
  5732.        $nm_saida->saida("                     obj_ac  = 'id_ac_grid_' + Tab_obj_grid_search[i] + i;\r\n");
  5733.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, obj_ac);\r\n");
  5734.        $nm_saida->saida("                 }\r\n");
  5735.        $nm_saida->saida("                 if (Tab_obj_grid_search[i] == 'proprietarios_cpf')\r\n");
  5736.        $nm_saida->saida("                 {\r\n");
  5737.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, '');\r\n");
  5738.        $nm_saida->saida("                 }\r\n");
  5739.        $nm_saida->saida("                 if((result == '' || result == '_VLS2_' || result == 'Y:_VLS_M:_VLS_D:_VLS2_Y:_VLS_M:_VLS_D:' || result == 'Y:_VLS_M:_VLS_D:_VLS_H:_VLS_I:_VLS_S:_VLS2_Y:_VLS_M:_VLS_D:_VLS_H:_VLS_I:_VLS_S:') && nm_empty_data_cond.indexOf(out_cond) == -1 && out_cond.substring(0, 3) != 'bi_')\r\n");
  5740.        $nm_saida->saida("                 {\r\n");
  5741.        $nm_saida->saida("                     alert(\"" $this->Ini->Nm_lang['lang_srch_req_field'] . "\");\r\n");
  5742.        $nm_saida->saida("                     return false;\r\n");
  5743.        $nm_saida->saida("                 }\r\n");
  5744.        $nm_saida->saida("                 out_dyn += \"_DYN_\" + result;\r\n");
  5745.        $nm_saida->saida("             }\r\n");
  5746.        $nm_saida->saida("         }\r\n");
  5747.        $nm_saida->saida("         ajax_navigate(Origem, out_dyn);\r\n");
  5748.        $nm_saida->saida("     }\r\n");
  5749.        $nm_saida->saida("     function nm_save_grid_search()\r\n");
  5750.        $nm_saida->saida("     {\r\n");
  5751.        $nm_saida->saida("         if (document.Fgrid_search_save.nmgp_save_name.value == '')\r\n");
  5752.        $nm_saida->saida("         {\r\n");
  5753.        $nm_saida->saida("             alert(\"" $this->Ini->Nm_lang['lang_srch_req_field'] . "\");\r\n");
  5754.        $nm_saida->saida("             document.Fgrid_search_save.nmgp_save_name.focus();\r\n");
  5755.        $nm_saida->saida("             return false;\r\n");
  5756.        $nm_saida->saida("         }\r\n");
  5757.        $nm_saida->saida("         save_name = document.Fgrid_search_save.nmgp_save_name.value;\r\n");
  5758.        $nm_saida->saida("         save_opt  = \"\"\r\n");
  5759.        $nm_saida->saida("         str_out = \"\";\r\n");
  5760.        $nm_saida->saida("         for (i = 1; i <= Tot_obj_grid_search; i++)\r\n");
  5761.        $nm_saida->saida("         {\r\n");
  5762.        $nm_saida->saida("             if (Tab_obj_grid_search[i] != 'NMSC_Grid_Null')\r\n");
  5763.        $nm_saida->saida("             {\r\n");
  5764.        $nm_saida->saida("                 obj_dyn  = 'grid_search_' + Tab_obj_grid_search[i] + '_cond_' + i;\r\n");
  5765.        $nm_saida->saida("                 out_cond = grid_search_get_sel_cond(obj_dyn);\r\n");
  5766.        $nm_saida->saida("                 str_out += \"SC_\" + Tab_obj_grid_search[i] + \"_cond#NMF#\" + out_cond + \"@NMF@\";\r\n");
  5767.        $nm_saida->saida("                 obj_dyn  = 'grid_search_' + Tab_obj_grid_search[i] + '_val_';\r\n");
  5768.        $nm_saida->saida("                 obj_dyn2 = 'grid_search_' + Tab_obj_grid_search[i] + '_v2__val_';\r\n");
  5769.        $nm_saida->saida("                 if (Tab_obj_grid_search[i] == 'proprietarios_idproprietario')\r\n");
  5770.        $nm_saida->saida("                 {\r\n");
  5771.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, '');\r\n");
  5772.        $nm_saida->saida("                     str_out += \"SC_\" + Tab_obj_grid_search[i] + \"#NMF#\" + result + \"@NMF@\";\r\n");
  5773.        $nm_saida->saida("                 }\r\n");
  5774.        $nm_saida->saida("                 if (Tab_obj_grid_search[i] == 'proprietarios_nome')\r\n");
  5775.        $nm_saida->saida("                 {\r\n");
  5776.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, '');\r\n");
  5777.        $nm_saida->saida("                     str_out += \"SC_\" + Tab_obj_grid_search[i] + \"#NMF#\" + result + \"@NMF@\";\r\n");
  5778.        $nm_saida->saida("                     obj_ac  = 'id_ac_grid_' + Tab_obj_grid_search[i] + i;\r\n");
  5779.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, obj_ac);\r\n");
  5780.        $nm_saida->saida("                     str_out += \"id_ac_\" + Tab_obj_grid_search[i] + \"#NMF#\" + result + \"@NMF@\";\r\n");
  5781.        $nm_saida->saida("                 }\r\n");
  5782.        $nm_saida->saida("                 if (Tab_obj_grid_search[i] == 'proprietarios_sexo')\r\n");
  5783.        $nm_saida->saida("                 {\r\n");
  5784.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, '');\r\n");
  5785.        $nm_saida->saida("                     str_out += \"SC_\" + Tab_obj_grid_search[i] + \"#NMF#\" + result + \"@NMF@\";\r\n");
  5786.        $nm_saida->saida("                     obj_ac  = 'id_ac_grid_' + Tab_obj_grid_search[i] + i;\r\n");
  5787.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, obj_ac);\r\n");
  5788.        $nm_saida->saida("                     str_out += \"id_ac_\" + Tab_obj_grid_search[i] + \"#NMF#\" + result + \"@NMF@\";\r\n");
  5789.        $nm_saida->saida("                 }\r\n");
  5790.        $nm_saida->saida("                 if (Tab_obj_grid_search[i] == 'proprietarios_cpf')\r\n");
  5791.        $nm_saida->saida("                 {\r\n");
  5792.        $nm_saida->saida("                     result  = grid_search_get_text(obj_dyn + i, '');\r\n");
  5793.        $nm_saida->saida("                     str_out += \"SC_\" + Tab_obj_grid_search[i] + \"#NMF#\" + result + \"@NMF@\";\r\n");
  5794.        $nm_saida->saida("                 }\r\n");
  5795.        $nm_saida->saida("             }\r\n");
  5796.        $nm_saida->saida("         }\r\n");
  5797.        $nm_saida->saida("         nmAjaxProcOn();\r\n");
  5798.        $nm_saida->saida("         $.ajax({\r\n");
  5799.        $nm_saida->saida("           type: \"POST\",\r\n");
  5800.        $nm_saida->saida("           url: \"index.php\",\r\n");
  5801.        $nm_saida->saida("           data: \"nmgp_opcao=ajax_filter_save&script_case_init=\" + document.Fgrid_search.script_case_init.value + \"&script_case_session=\" + document.Fgrid_search.script_case_session.value + \"&nmgp_save_name=\" + save_name + \"&nmgp_save_option=\" + save_opt + \"&NM_filters_save=\" + str_out + \"&nmgp_save_origem=grid\"\r\n");
  5802.        $nm_saida->saida("          })\r\n");
  5803.        $nm_saida->saida("          .done(function(json_save_fil) {\r\n");
  5804.        $nm_saida->saida("             var i, oResp;\r\n");
  5805.        $nm_saida->saida("             Tst_integrid = json_save_fil.trim();\r\n");
  5806.        $nm_saida->saida("             if (\"{\" != Tst_integrid.substr(0, 1)) {\r\n");
  5807.        $nm_saida->saida("                 nmAjaxProcOff();\r\n");
  5808.        $nm_saida->saida("                 alert (json_save_fil);\r\n");
  5809.        $nm_saida->saida("                 return;\r\n");
  5810.        $nm_saida->saida("             }\r\n");
  5811.        $nm_saida->saida("             eval(\"oResp = \" + json_save_fil);\r\n");
  5812. $nm_saida->saida("             if (oResp[\"ss_time_out\"]) {\r\n");
  5813. $nm_saida->saida("                 nmAjaxProcOff();\r\n");
  5814. $nm_saida->saida("                 nm_move();\r\n");
  5815. $nm_saida->saida("             }\r\n");
  5816.        $nm_saida->saida("             if (oResp[\"setValue\"]) {\r\n");
  5817.        $nm_saida->saida("               for (i = 0; i < oResp[\"setValue\"].length; i++) {\r\n");
  5818.        $nm_saida->saida("                    $(\"#\" + oResp[\"setValue\"][i][\"field\"]).html(oResp[\"setValue\"][i][\"value\"]);\r\n");
  5819.        $nm_saida->saida("               }\r\n");
  5820.        $nm_saida->saida("             }\r\n");
  5821.        $nm_saida->saida("             if (oResp[\"htmOutput\"]) {\r\n");
  5822.        $nm_saida->saida("                 nmAjaxShowDebug(oResp);\r\n");
  5823.        $nm_saida->saida("              }\r\n");
  5824.        $nm_saida->saida("             document.getElementById('SC_nmgp_save_name').value = '';\r\n");
  5825.        $nm_saida->saida("             document.getElementById('Apaga_filters').style.display = '';\r\n");
  5826.        $nm_saida->saida("             document.getElementById('id_sel_recup_filters').style.display = '';\r\n");
  5827.        $nm_saida->saida("             document.getElementById('Salvar_filters').style.display = 'none';\r\n");
  5828.        $nm_saida->saida("             document.getElementById('id_sel_recup_filters').selectedIndex = -1;\r\n");
  5829.        $nm_saida->saida("             document.getElementById('sel_filters_del').selectedIndex = -1;\r\n");
  5830.        $nm_saida->saida("             nmAjaxProcOff();\r\n");
  5831.        $nm_saida->saida("         });\r\n");
  5832.        $nm_saida->saida("     }\r\n");
  5833.        $nm_saida->saida("     function nm_del_grid_search()\r\n");
  5834.        $nm_saida->saida("     {\r\n");
  5835.        $nm_saida->saida("        obj_sel = document.Fgrid_search_save.elements['NM_filters_del'];\r\n");
  5836.        $nm_saida->saida("        index   = obj_sel.selectedIndex;\r\n");
  5837.        $nm_saida->saida("        if (index == -1 || obj_sel.options[index].value == \"\") \r\n");
  5838.        $nm_saida->saida("        {\r\n");
  5839.        $nm_saida->saida("            return false;\r\n");
  5840.        $nm_saida->saida("        }\r\n");
  5841.        $nm_saida->saida("        parm = obj_sel.options[index].value;\r\n");
  5842.        $nm_saida->saida("        nmAjaxProcOn();\r\n");
  5843.        $nm_saida->saida("        $.ajax({\r\n");
  5844.        $nm_saida->saida("          type: \"POST\",\r\n");
  5845.        $nm_saida->saida("          url: \"index.php\",\r\n");
  5846.        $nm_saida->saida("          data: \"nmgp_opcao=ajax_filter_delete&script_case_init=\" + document.Fgrid_search.script_case_init.value + \"&script_case_session=\" + document.Fgrid_search.script_case_session.value + \"&NM_filters_del=\" + parm + \"&nmgp_save_origem=grid\"\r\n");
  5847.        $nm_saida->saida("         })\r\n");
  5848.        $nm_saida->saida("         .done(function(json_del_fil) {\r\n");
  5849.        $nm_saida->saida("            var i, oResp;\r\n");
  5850.        $nm_saida->saida("            Tst_integrid = json_del_fil.trim();\r\n");
  5851.        $nm_saida->saida("            if (\"{\" != Tst_integrid.substr(0, 1)) {\r\n");
  5852.        $nm_saida->saida("                nmAjaxProcOff();\r\n");
  5853.        $nm_saida->saida("                alert (json_del_fil);\r\n");
  5854.        $nm_saida->saida("                return;\r\n");
  5855.        $nm_saida->saida("            }\r\n");
  5856.        $nm_saida->saida("            eval(\"oResp = \" + json_del_fil);\r\n");
  5857. $nm_saida->saida("             if (oResp[\"ss_time_out\"]) {\r\n");
  5858. $nm_saida->saida("                 nmAjaxProcOff();\r\n");
  5859. $nm_saida->saida("                 nm_move();\r\n");
  5860. $nm_saida->saida("             }\r\n");
  5861.        $nm_saida->saida("            if (oResp[\"setValue\"]) {\r\n");
  5862.        $nm_saida->saida("              for (i = 0; i < oResp[\"setValue\"].length; i++) {\r\n");
  5863.        $nm_saida->saida("                   $(\"#\" + oResp[\"setValue\"][i][\"field\"]).html(oResp[\"setValue\"][i][\"value\"]);\r\n");
  5864.        $nm_saida->saida("              }\r\n");
  5865.        $nm_saida->saida("            }\r\n");
  5866.        $nm_saida->saida("            if (oResp[\"htmOutput\"]) {\r\n");
  5867.        $nm_saida->saida("                nmAjaxShowDebug(oResp);\r\n");
  5868.        $nm_saida->saida("            }\r\n");
  5869.        $nm_saida->saida("            nmAjaxProcOff();\r\n");
  5870.        $nm_saida->saida("        });\r\n");
  5871.        $nm_saida->saida("     }\r\n");
  5872.        $nm_saida->saida("     function nm_change_grid_search(obj_sel)\r\n");
  5873.        $nm_saida->saida("     {\r\n");
  5874.        $nm_saida->saida("        index = obj_sel.selectedIndex;\r\n");
  5875.        $nm_saida->saida("        if (index == -1 || obj_sel.options[index].value == \"\") \r\n");
  5876.        $nm_saida->saida("        {\r\n");
  5877.        $nm_saida->saida("            return false;\r\n");
  5878.        $nm_saida->saida("        }\r\n");
  5879.        $nm_saida->saida("        for (i = 1; i <= Tot_obj_grid_search; i++)\r\n");
  5880.        $nm_saida->saida("        {\r\n");
  5881.        $nm_saida->saida("            $('#grid_search_' + Tab_obj_grid_search[i]).remove();\r\n");
  5882.        $nm_saida->saida("             eval('Dropdownchecklist_'+ Tab_obj_grid_search[i] +'=false;');\r\n");
  5883.        $nm_saida->saida("        }\r\n");
  5884.        $nm_saida->saida("        Tot_obj_grid_search = 0;\r\n");
  5885.        $nm_saida->saida("        Tab_obj_grid_search = new Array();\r\n");
  5886.        $nm_saida->saida("        ajax_navigate('grid_search_change_fil', obj_sel.options[index].value);;\r\n");
  5887.        $nm_saida->saida("     }\r\n");
  5888.        $nm_saida->saida("     function grid_search_get_sel_cond(obj_id)\r\n");
  5889.        $nm_saida->saida("     {\r\n");
  5890.        $nm_saida->saida("        var index = document.getElementById(obj_id).selectedIndex;\r\n");
  5891.        $nm_saida->saida("        return document.getElementById(obj_id).options[index].value;\r\n");
  5892.        $nm_saida->saida("     }\r\n");
  5893.        $nm_saida->saida("     function grid_search_get_select(obj_id, str_type)\r\n");
  5894.        $nm_saida->saida("     {\r\n");
  5895.        $nm_saida->saida("        if(str_type == '')\r\n");
  5896.        $nm_saida->saida("        {\r\n");
  5897.        $nm_saida->saida("            var obj = document.getElementById(obj_id);\r\n");
  5898.        $nm_saida->saida("        }\r\n");
  5899.        $nm_saida->saida("        else\r\n");
  5900.        $nm_saida->saida("        {\r\n");
  5901.        $nm_saida->saida("            var obj = $('#' + obj_id).multipleSelect('getSelects');\r\n");
  5902.        $nm_saida->saida("        }\r\n");
  5903.        $nm_saida->saida("        var val = \"\";\r\n");
  5904.        $nm_saida->saida("        for (iSelect = 0; iSelect < obj.length; iSelect++)\r\n");
  5905.        $nm_saida->saida("        {\r\n");
  5906.        $nm_saida->saida("            if ((str_type == '' && obj[iSelect].selected) || (str_type=='RADIO' || str_type=='CHECKBOX'))\r\n");
  5907.        $nm_saida->saida("            {\r\n");
  5908.        $nm_saida->saida("                if(str_type == '' && obj[iSelect].selected)\r\n");
  5909.        $nm_saida->saida("                {\r\n");
  5910.        $nm_saida->saida("                    new_val = obj[iSelect].value;\r\n");
  5911.        $nm_saida->saida("                }\r\n");
  5912.        $nm_saida->saida("                else\r\n");
  5913.        $nm_saida->saida("                {\r\n");
  5914.        $nm_saida->saida("                    new_val = obj[iSelect];\r\n");
  5915.        $nm_saida->saida("                }\r\n");
  5916.        $nm_saida->saida("                val += (val != \"\") ? \"_VLS_\" : \"\";\r\n");
  5917.        $nm_saida->saida("                val += new_val;\r\n");
  5918.        $nm_saida->saida("            }\r\n");
  5919.        $nm_saida->saida("        }\r\n");
  5920.        $nm_saida->saida("        return val;\r\n");
  5921.        $nm_saida->saida("     }\r\n");
  5922.        $nm_saida->saida("     function grid_search_get_Dselelect(obj_id)\r\n");
  5923.        $nm_saida->saida("     {\r\n");
  5924.        $nm_saida->saida("        var obj = document.getElementById(obj_id);\r\n");
  5925.        $nm_saida->saida("        var val = \"\";\r\n");
  5926.        $nm_saida->saida("        for (iSelect = 0; iSelect < obj.length; iSelect++)\r\n");
  5927.        $nm_saida->saida("        {\r\n");
  5928.        $nm_saida->saida("            val += (val != \"\") ? \"_VLS_\" : \"\";\r\n");
  5929.        $nm_saida->saida("            val += obj[iSelect].value;\r\n");
  5930.        $nm_saida->saida("        }\r\n");
  5931.        $nm_saida->saida("        return val;\r\n");
  5932.        $nm_saida->saida("     }\r\n");
  5933.        $nm_saida->saida("     function grid_search_get_radio(obj_id)\r\n");
  5934.        $nm_saida->saida("     {\r\n");
  5935.        $nm_saida->saida("        var Nobj = document.getElementById(obj_id).name;\r\n");
  5936.        $nm_saida->saida("        var obj  = document.getElementsByName(Nobj);\r\n");
  5937.        $nm_saida->saida("        var val  = \"\";\r\n");
  5938.        $nm_saida->saida("        for (iRadio = 0; iRadio < obj.length; iRadio++)\r\n");
  5939.        $nm_saida->saida("        {\r\n");
  5940.        $nm_saida->saida("            if (obj[iRadio].checked)\r\n");
  5941.        $nm_saida->saida("            {\r\n");
  5942.        $nm_saida->saida("                val += (val != \"\") ? \"_VLS_\" : \"\";\r\n");
  5943.        $nm_saida->saida("                val += obj[iRadio].value;\r\n");
  5944.        $nm_saida->saida("            }\r\n");
  5945.        $nm_saida->saida("        }\r\n");
  5946.        $nm_saida->saida("        return val;\r\n");
  5947.        $nm_saida->saida("     }\r\n");
  5948.        $nm_saida->saida("     function grid_search_get_checkbox(obj_id)\r\n");
  5949.        $nm_saida->saida("     {\r\n");
  5950.        $nm_saida->saida("        var Nobj = document.getElementById(obj_id).name;\r\n");
  5951.        $nm_saida->saida("        var obj  = document.getElementsByName(Nobj);\r\n");
  5952.        $nm_saida->saida("        var val  = \"\";\r\n");
  5953.        $nm_saida->saida("        if (!obj.length)\r\n");
  5954.        $nm_saida->saida("        {\r\n");
  5955.        $nm_saida->saida("            if (obj.checked)\r\n");
  5956.        $nm_saida->saida("            {\r\n");
  5957.        $nm_saida->saida("                val = obj.value;\r\n");
  5958.        $nm_saida->saida("            }\r\n");
  5959.        $nm_saida->saida("            return val;\r\n");
  5960.        $nm_saida->saida("        }\r\n");
  5961.        $nm_saida->saida("        else\r\n");
  5962.        $nm_saida->saida("        {\r\n");
  5963.        $nm_saida->saida("            for (iCheck = 0; iCheck < obj.length; iCheck++)\r\n");
  5964.        $nm_saida->saida("            {\r\n");
  5965.        $nm_saida->saida("                if (obj[iCheck].checked)\r\n");
  5966.        $nm_saida->saida("                {\r\n");
  5967.        $nm_saida->saida("                    val += (val != \"\") ? \"_VLS_\" : \"\";\r\n");
  5968.        $nm_saida->saida("                    val += obj[iCheck].value;\r\n");
  5969.        $nm_saida->saida("                }\r\n");
  5970.        $nm_saida->saida("            }\r\n");
  5971.        $nm_saida->saida("        }\r\n");
  5972.        $nm_saida->saida("        return val;\r\n");
  5973.        $nm_saida->saida("     }\r\n");
  5974.        $nm_saida->saida("     function grid_search_get_text(obj_id, obj_ac)\r\n");
  5975.        $nm_saida->saida("     {\r\n");
  5976.        $nm_saida->saida("        var obj = document.getElementById(obj_id);\r\n");
  5977.        $nm_saida->saida("        var val = \"\";\r\n");
  5978.        $nm_saida->saida("        if (obj)\r\n");
  5979.        $nm_saida->saida("        {\r\n");
  5980.        $nm_saida->saida("            val = obj.value;\r\n");
  5981.        $nm_saida->saida("        }\r\n");
  5982.        $nm_saida->saida("        if (obj_ac != '' && val == '')\r\n");
  5983.        $nm_saida->saida("        {\r\n");
  5984.        $nm_saida->saida("            obj = document.getElementById(obj_ac);\r\n");
  5985.        $nm_saida->saida("            if (obj)\r\n");
  5986.        $nm_saida->saida("            {\r\n");
  5987.        $nm_saida->saida("                val = obj.value;\r\n");
  5988.        $nm_saida->saida("            }\r\n");
  5989.        $nm_saida->saida("        }\r\n");
  5990.        $nm_saida->saida("        return val;\r\n");
  5991.        $nm_saida->saida("     }\r\n");
  5992.        $nm_saida->saida("     function grid_search_get_dt_h(obj_id, ind, TP)\r\n");
  5993.        $nm_saida->saida("     {\r\n");
  5994.        $nm_saida->saida("        var val = new Array();\r\n");
  5995.        $nm_saida->saida("        if (TP == 'DT' || TP == 'DH')\r\n");
  5996.        $nm_saida->saida("        {\r\n");
  5997.        $nm_saida->saida("            obj_part  = document.getElementById(obj_id + '_ano_val_' + ind);\r\n");
  5998.        $nm_saida->saida("            val      += \"Y:\";\r\n");
  5999.        $nm_saida->saida("            if (obj_part && obj_part.type.substr(0, 6) == 'select')\r\n");
  6000.        $nm_saida->saida("            {\r\n");
  6001.        $nm_saida->saida("                Tval = grid_search_get_sel_cond(obj_id + '_ano_val_' + ind);\r\n");
  6002.        $nm_saida->saida("                val += (Tval != -1) ? Tval : '';\r\n");
  6003.        $nm_saida->saida("            }\r\n");
  6004.        $nm_saida->saida("            else\r\n");
  6005.        $nm_saida->saida("            {\r\n");
  6006.        $nm_saida->saida("                val += (obj_part) ? obj_part.value : '';\r\n");
  6007.        $nm_saida->saida("            }\r\n");
  6008.        $nm_saida->saida("            obj_part  = document.getElementById(obj_id + '_mes_val_' + ind);\r\n");
  6009.        $nm_saida->saida("            val      += \"_VLS_M:\";\r\n");
  6010.        $nm_saida->saida("            if (obj_part && obj_part.type.substr(0, 6) == 'select')\r\n");
  6011.        $nm_saida->saida("            {\r\n");
  6012.        $nm_saida->saida("                Tval = grid_search_get_sel_cond(obj_id + '_mes_val_' + ind);\r\n");
  6013.        $nm_saida->saida("                val += (Tval != -1) ? Tval : '';\r\n");
  6014.        $nm_saida->saida("            }\r\n");
  6015.        $nm_saida->saida("            else\r\n");
  6016.        $nm_saida->saida("            {\r\n");
  6017.        $nm_saida->saida("                val += (obj_part) ? obj_part.value : '';\r\n");
  6018.        $nm_saida->saida("            }\r\n");
  6019.        $nm_saida->saida("            obj_part  = document.getElementById(obj_id + '_dia_val_' + ind);\r\n");
  6020.        $nm_saida->saida("            val      += \"_VLS_D:\";\r\n");
  6021.        $nm_saida->saida("            if (obj_part && obj_part.type.substr(0, 6) == 'select')\r\n");
  6022.        $nm_saida->saida("            {\r\n");
  6023.        $nm_saida->saida("                Tval = grid_search_get_sel_cond(obj_id + '_dia_val_' + ind);\r\n");
  6024.        $nm_saida->saida("                val += (Tval != -1) ? Tval : '';\r\n");
  6025.        $nm_saida->saida("            }\r\n");
  6026.        $nm_saida->saida("            else\r\n");
  6027.        $nm_saida->saida("            {\r\n");
  6028.        $nm_saida->saida("                val += (obj_part) ? obj_part.value : '';\r\n");
  6029.        $nm_saida->saida("            }\r\n");
  6030.        $nm_saida->saida("        }\r\n");
  6031.        $nm_saida->saida("        if (TP == 'HH' || TP == 'DH')\r\n");
  6032.        $nm_saida->saida("        {\r\n");
  6033.        $nm_saida->saida("            val            += (val != \"\") ? \"_VLS_\" : \"\";\r\n");
  6034.        $nm_saida->saida("            obj_part        = document.getElementById(obj_id + '_hor_val_' + ind);\r\n");
  6035.        $nm_saida->saida("            val            += \"H:\";\r\n");
  6036.        $nm_saida->saida("            val            += (obj_part) ? obj_part.value : '';\r\n");
  6037.        $nm_saida->saida("            obj_part        = document.getElementById(obj_id + '_min_val_' + ind);\r\n");
  6038.        $nm_saida->saida("            val            += \"_VLS_I:\";\r\n");
  6039.        $nm_saida->saida("            val            += (obj_part) ? obj_part.value : '';\r\n");
  6040.        $nm_saida->saida("            obj_part        = document.getElementById(obj_id + '_seg_val_' + ind);\r\n");
  6041.        $nm_saida->saida("            val            += \"_VLS_S:\";\r\n");
  6042.        $nm_saida->saida("            val            += (obj_part) ? obj_part.value : '';\r\n");
  6043.        $nm_saida->saida("        }\r\n");
  6044.        $nm_saida->saida("        return val;\r\n");
  6045.        $nm_saida->saida("     }\r\n");
  6046.        $nm_saida->saida("   </script>\r\n");
  6047.    }
  6048.    function nm_gera_mask(&$nm_campo$nm_mask)
  6049.    { 
  6050.       $trab_campo $nm_campo;
  6051.       $trab_mask  $nm_mask;
  6052.       $tam_campo  strlen($nm_campo);
  6053.       $trab_saida "";
  6054.       $mask_num false;
  6055.       for ($x=0$x strlen($trab_mask); $x++)
  6056.       {
  6057.           if (substr($trab_mask$x1) == "#")
  6058.           {
  6059.               $mask_num true;
  6060.               break;
  6061.           }
  6062.       }
  6063.       if ($mask_num )
  6064.       {
  6065.           $ver_duas explode(";"$trab_mask);
  6066.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  6067.           {
  6068.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  6069.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  6070.               if ($cont2 >= $tam_campo)
  6071.               {
  6072.                   $trab_mask $ver_duas[1];
  6073.               }
  6074.               else
  6075.               {
  6076.                   $trab_mask $ver_duas[0];
  6077.               }
  6078.           }
  6079.           $tam_mask strlen($trab_mask);
  6080.           $xdados 0;
  6081.           for ($x=0$x $tam_mask$x++)
  6082.           {
  6083.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  6084.               {
  6085.                   $trab_saida .= substr($trab_campo$xdados1);
  6086.                   $xdados++;
  6087.               }
  6088.               elseif ($xdados $tam_campo)
  6089.               {
  6090.                   $trab_saida .= substr($trab_mask$x1);
  6091.               }
  6092.           }
  6093.           if ($xdados $tam_campo)
  6094.           {
  6095.               $trab_saida .= substr($trab_campo$xdados);
  6096.           }
  6097.           $nm_campo $trab_saida;
  6098.           return;
  6099.       }
  6100.       for ($ix strlen($trab_mask); $ix 0$ix--)
  6101.       {
  6102.            $char_mask substr($trab_mask$ix 11);
  6103.            if ($char_mask != "x" && $char_mask != "z")
  6104.            {
  6105.                $trab_saida $char_mask $trab_saida;
  6106.            }
  6107.            else
  6108.            {
  6109.                if ($tam_campo != 0)
  6110.                {
  6111.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  6112.                    $tam_campo--;
  6113.                }
  6114.                else
  6115.                {
  6116.                    $trab_saida "0" $trab_saida;
  6117.                }
  6118.            }
  6119.       }
  6120.       if ($tam_campo != 0)
  6121.       {
  6122.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  6123.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  6124.       }
  6125.    
  6126.       $iz 0
  6127.       for ($ix 0$ix strlen($trab_mask); $ix++)
  6128.       {
  6129.            $char_mask substr($trab_mask$ix1);
  6130.            if ($char_mask != "x" && $char_mask != "z")
  6131.            {
  6132.                if ($char_mask == "." || $char_mask == ",")
  6133.                {
  6134.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  6135.                }
  6136.                else
  6137.                {
  6138.                    $iz++;
  6139.                }
  6140.            }
  6141.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  6142.            {
  6143.                $ix strlen($trab_mask) + 1;
  6144.            }
  6145.            else
  6146.            {
  6147.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  6148.            }
  6149.       }
  6150.       $nm_campo $trab_saida;
  6151.    } 
  6152.  function check_btns()
  6153.  {
  6154.      $sv $this->NM_css_ajx_embed;
  6155.      if (!isset($this->Ini->$sv) || empty($this->Ini->$sv) || strlen($this->Ini->$sv) != $_SESSION[$this->NM_css_val_embed]) {exit;}
  6156.  }
  6157.  function nm_fim_grid($flag_apaga_pdf_log TRUE)
  6158.  {
  6159.    global
  6160.    $nm_saida$nm_url_saida$NMSC_modal;
  6161.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && isset($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css']))
  6162.    {
  6163.        unset($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css']);
  6164.        unset($_SESSION['sc_session'][$this->Ini->sc_page]['SC_sub_css_bw']);
  6165.    }
  6166.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  6167.    { 
  6168.         return;
  6169.    } 
  6170.    $nm_saida->saida("   </TABLE>\r\n");
  6171.    $nm_saida->saida("   </div>\r\n");
  6172.    $nm_saida->saida("   </TR>\r\n");
  6173.    $nm_saida->saida("   </TD>\r\n");
  6174.    $nm_saida->saida("   </TABLE>\r\n");
  6175.    $nm_saida->saida("   <div id=\"sc-id-fixedheaders-placeholder\" style=\"display: none; position: fixed; top: 0\"></div>\r\n");
  6176.    $nm_saida->saida("   </body>\r\n");
  6177.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" || $this->Print_All)
  6178.    { 
  6179.    $nm_saida->saida("   </HTML>\r\n");
  6180.         return;
  6181.    } 
  6182.    $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  6183.    $nm_saida->saida("   NM_ancor_ult_lig = '';\r\n");
  6184.    if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  6185.    { 
  6186.        if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['NM_arr_tree']))
  6187.        {
  6188.            $temp = array();
  6189.            foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['NM_arr_tree'] as $NM_aplic => $resto)
  6190.            {
  6191.                $temp[] = $NM_aplic;
  6192.            }
  6193.            $temp array_unique($temp);
  6194.            foreach ($temp as $NM_aplic)
  6195.            {
  6196.                if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6197.                { 
  6198.                    $this->Ini->Arr_result['setArr'][] = array('var' => ' NM_tab_' $NM_aplic'value' => '');
  6199.                } 
  6200.                $nm_saida->saida("   NM_tab_" $NM_aplic " = new Array();\r\n");
  6201.            }
  6202.            foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['NM_arr_tree'] as $NM_aplic => $resto)
  6203.            {
  6204.                foreach ($resto as $NM_ind => $NM_quebra)
  6205.                {
  6206.                    foreach ($NM_quebra as $NM_nivel => $NM_tipo)
  6207.                    {
  6208.                        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6209.                        { 
  6210.                            $this->Ini->Arr_result['setVar'][] = array('var' => ' NM_tab_' $NM_aplic '[' $NM_ind ']''value' => $NM_tipo $NM_nivel);
  6211.                        } 
  6212.                        $nm_saida->saida("   NM_tab_" $NM_aplic "[" $NM_ind "] = '" $NM_tipo $NM_nivel "';\r\n");
  6213.                    }
  6214.                }
  6215.            }
  6216.        }
  6217.    }
  6218.    $nm_saida->saida("   function NM_liga_tbody(tbody, Obj, Apl)\r\n");
  6219.    $nm_saida->saida("   {\r\n");
  6220.    $nm_saida->saida("      Nivel = parseInt (Obj[tbody].substr(3));\r\n");
  6221.    $nm_saida->saida("      for (ind = tbody + 1; ind < Obj.length; ind++)\r\n");
  6222.    $nm_saida->saida("      {\r\n");
  6223.    $nm_saida->saida("           Nv = parseInt (Obj[ind].substr(3));\r\n");
  6224.    $nm_saida->saida("           Tp = Obj[ind].substr(0, 3);\r\n");
  6225.    $nm_saida->saida("           if (Nivel == Nv && Tp == 'top')\r\n");
  6226.    $nm_saida->saida("           {\r\n");
  6227.    $nm_saida->saida("               break;\r\n");
  6228.    $nm_saida->saida("           }\r\n");
  6229.    $nm_saida->saida("           if (((Nivel + 1) == Nv && Tp == 'top') || (Nivel == Nv && Tp == 'bot'))\r\n");
  6230.    $nm_saida->saida("           {\r\n");
  6231.    $nm_saida->saida("               document.getElementById('tbody_' + Apl + '_' + ind + '_' + Tp).style.display='';\r\n");
  6232.    $nm_saida->saida("           } \r\n");
  6233.    $nm_saida->saida("      }\r\n");
  6234.    $nm_saida->saida("   }\r\n");
  6235.    $nm_saida->saida("   function NM_apaga_tbody(tbody, Obj, Apl)\r\n");
  6236.    $nm_saida->saida("   {\r\n");
  6237.    $nm_saida->saida("      Nivel = Obj[tbody].substr(3);\r\n");
  6238.    $nm_saida->saida("      for (ind = tbody + 1; ind < Obj.length; ind++)\r\n");
  6239.    $nm_saida->saida("      {\r\n");
  6240.    $nm_saida->saida("           Nv = Obj[ind].substr(3);\r\n");
  6241.    $nm_saida->saida("           Tp = Obj[ind].substr(0, 3);\r\n");
  6242.    $nm_saida->saida("           if ((Nivel == Nv && Tp == 'top') || Nv < Nivel)\r\n");
  6243.    $nm_saida->saida("           {\r\n");
  6244.    $nm_saida->saida("               break;\r\n");
  6245.    $nm_saida->saida("           }\r\n");
  6246.    $nm_saida->saida("           if ((Nivel != Nv) || (Nivel == Nv && Tp == 'bot'))\r\n");
  6247.    $nm_saida->saida("           {\r\n");
  6248.    $nm_saida->saida("               document.getElementById('tbody_' + Apl + '_' + ind + '_' + Tp).style.display='none';\r\n");
  6249.    $nm_saida->saida("               if (Tp == 'top')\r\n");
  6250.    $nm_saida->saida("               {\r\n");
  6251.    $nm_saida->saida("                   document.getElementById('b_open_' + Apl + '_' + ind).style.display='';\r\n");
  6252.    $nm_saida->saida("                   document.getElementById('b_close_' + Apl + '_' + ind).style.display='none';\r\n");
  6253.    $nm_saida->saida("               } \r\n");
  6254.    $nm_saida->saida("           } \r\n");
  6255.    $nm_saida->saida("      }\r\n");
  6256.    $nm_saida->saida("   }\r\n");
  6257.    $nm_saida->saida("   NM_obj_ant = '';\r\n");
  6258.    $nm_saida->saida("   function NM_apaga_div_lig(obj_nome)\r\n");
  6259.    $nm_saida->saida("   {\r\n");
  6260.    $nm_saida->saida("      if (NM_obj_ant != '')\r\n");
  6261.    $nm_saida->saida("      {\r\n");
  6262.    $nm_saida->saida("          NM_obj_ant.style.display='none';\r\n");
  6263.    $nm_saida->saida("      }\r\n");
  6264.    $nm_saida->saida("      obj = document.getElementById(obj_nome);\r\n");
  6265.    $nm_saida->saida("      NM_obj_ant = obj;\r\n");
  6266.    $nm_saida->saida("      ind_time = setTimeout(\"obj.style.display='none'\", 300);\r\n");
  6267.    $nm_saida->saida("      return ind_time;\r\n");
  6268.    $nm_saida->saida("   }\r\n");
  6269.    $str_pbfile $this->Ini->root $this->Ini->path_imag_temp '/sc_pb_' session_id() . '.tmp';
  6270.    if (@is_file($str_pbfile) && $flag_apaga_pdf_log)
  6271.    {
  6272.       @unlink($str_pbfile);
  6273.    }
  6274.    if ($this->Rec_ini == && empty($this->nm_grid_sem_reg) && !$this->Print_All && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && !$_SESSION['scriptcase']['proc_mobile'])
  6275.    { 
  6276.        $nm_saida->saida("   document.getElementById('first_bot').disabled = true;\r\n");
  6277.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6278.        {
  6279.            $this->Ini->Arr_result['setDisabled'][] = array('field' => 'first_bot''value' => "true");
  6280.        }
  6281.        $nm_saida->saida("   document.getElementById('back_bot').disabled = true;\r\n");
  6282.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6283.        {
  6284.            $this->Ini->Arr_result['setDisabled'][] = array('field' => 'back_bot''value' => "true");
  6285.        }
  6286.    } 
  6287.    elseif ($this->Rec_ini == && empty($this->nm_grid_sem_reg) && !$this->Print_All && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && $_SESSION['scriptcase']['proc_mobile'])
  6288.    { 
  6289.        $nm_saida->saida("   document.getElementById('first_bot').disabled = true;\r\n");
  6290.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6291.        {
  6292.            $this->Ini->Arr_result['setDisabled'][] = array('field' => 'first_bot''value' => "true");
  6293.        }
  6294.        $nm_saida->saida("   document.getElementById('back_bot').disabled = true;\r\n");
  6295.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6296.        {
  6297.            $this->Ini->Arr_result['setDisabled'][] = array('field' => 'back_bot''value' => "true");
  6298.        }
  6299.    } 
  6300.    $nm_saida->saida("  $(window).scroll(function() {\r\n");
  6301.    $nm_saida->saida("   if (typeof(scSetFixedHeaders) === typeof(function(){})) scSetFixedHeaders();\r\n");
  6302.    $nm_saida->saida("  }).resize(function() {\r\n");
  6303.    $nm_saida->saida("   if (typeof(scSetFixedHeaders) === typeof(function(){})) scSetFixedHeaders();\r\n");
  6304.    $nm_saida->saida("  });\r\n");
  6305.    if ($this->rs_grid->EOF && empty($this->nm_grid_sem_reg) && !$this->Print_All && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf")
  6306.    {
  6307.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']) && !$_SESSION['scriptcase']['proc_mobile'])
  6308.        { 
  6309.            { 
  6310.                $nm_saida->saida("   document.getElementById('forward_bot').disabled = true;\r\n");
  6311.                $nm_saida->saida("   document.getElementById('forward_bot').className = \"scButton_" $this->arr_buttons['bcons_avanca']['style'] . " disabled\";\r\n");
  6312.                if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6313.                {
  6314.                    $this->Ini->Arr_result['setDisabled'][] = array('field' => 'forward_bot''value' => "true");
  6315.                    $this->Ini->Arr_result['setClass'][] = array('field' => 'forward_bot''value' => "scButton_" $this->arr_buttons['bcons_avanca']['style'] . ' disabled');
  6316.                }
  6317.                if ($this->arr_buttons['bcons_avanca']['display'] == 'only_img' || $this->arr_buttons['bcons_avanca']['display'] == 'text_img')
  6318.                { 
  6319.                    $nm_saida->saida("   document.getElementById('id_img_forward_bot').src = \"" $this->Ini->path_botoes "/" $this->arr_buttons['bcons_avanca']['image'] . "\";\r\n");
  6320.                    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6321.                    {
  6322.                        $this->Ini->Arr_result['setSrc'][] = array('field' => 'id_img_forward_bot''value' => $this->Ini->path_botoes "/" $this->arr_buttons['bcons_avanca']['image']);
  6323.                    }
  6324.                } 
  6325.            } 
  6326.            { 
  6327.                $nm_saida->saida("   document.getElementById('last_bot').disabled = true;\r\n");
  6328.                $nm_saida->saida("   document.getElementById('last_bot').className = \"scButton_" $this->arr_buttons['bcons_final']['style'] . " disabled\";\r\n");
  6329.                if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6330.                {
  6331.                   $this->Ini->Arr_result['setDisabled'][] = array('field' => 'last_bot''value' => "true");
  6332.                   $this->Ini->Arr_result['setClass'][] = array('field' => 'last_bot''value' => "scButton_" $this->arr_buttons['bcons_final']['style'] . ' disabled');
  6333.                }
  6334.                if ($this->arr_buttons['bcons_final']['display'] == 'only_img' || $this->arr_buttons['bcons_final']['display'] == 'text_img')
  6335.                { 
  6336.                    $nm_saida->saida("   document.getElementById('id_img_last_bot').src = \"" $this->Ini->path_botoes "/" $this->arr_buttons['bcons_final']['image'] . "\";\r\n");
  6337.                    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6338.                    {
  6339.                        $this->Ini->Arr_result['setSrc'][] = array('field' => 'id_img_last_bot''value' => $this->Ini->path_botoes "/" $this->arr_buttons['bcons_final']['image']);
  6340.                    }
  6341.                } 
  6342.            } 
  6343.        } 
  6344.        elseif ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "pdf" && !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['nav']) && $_SESSION['scriptcase']['proc_mobile'])
  6345.        { 
  6346.            { 
  6347.                $nm_saida->saida("   document.getElementById('forward_bot').disabled = true;\r\n");
  6348.                $nm_saida->saida("   document.getElementById('forward_bot').className = \"scButton_" $this->arr_buttons['bcons_avanca']['style'] . " disabled\";\r\n");
  6349.                if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6350.                {
  6351.                    $this->Ini->Arr_result['setDisabled'][] = array('field' => 'forward_bot''value' => "true");
  6352.                    $this->Ini->Arr_result['setClass'][] = array('field' => 'forward_bot''value' => "scButton_" $this->arr_buttons['bcons_avanca']['style'] . ' disabled');
  6353.                }
  6354.                if ($this->arr_buttons['bcons_avanca']['display'] == 'only_img' || $this->arr_buttons['bcons_avanca']['display'] == 'text_img')
  6355.                { 
  6356.                    $nm_saida->saida("   document.getElementById('id_img_forward_bot').src = \"" $this->Ini->path_botoes "/" $this->arr_buttons['bcons_avanca']['image'] . "\";\r\n");
  6357.                    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6358.                    {
  6359.                        $this->Ini->Arr_result['setSrc'][] = array('field' => 'id_img_forward_bot''value' => $this->Ini->path_botoes "/" $this->arr_buttons['bcons_avanca']['image']);
  6360.                    }
  6361.                } 
  6362.            } 
  6363.            { 
  6364.                $nm_saida->saida("   document.getElementById('last_bot').disabled = true;\r\n");
  6365.                $nm_saida->saida("   document.getElementById('last_bot').className = \"scButton_" $this->arr_buttons['bcons_final']['style'] . " disabled\";\r\n");
  6366.                if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6367.                {
  6368.                   $this->Ini->Arr_result['setDisabled'][] = array('field' => 'last_bot''value' => "true");
  6369.                   $this->Ini->Arr_result['setClass'][] = array('field' => 'last_bot''value' => "scButton_" $this->arr_buttons['bcons_final']['style'] . ' disabled');
  6370.                }
  6371.                if ($this->arr_buttons['bcons_final']['display'] == 'only_img' || $this->arr_buttons['bcons_final']['display'] == 'text_img')
  6372.                { 
  6373.                    $nm_saida->saida("   document.getElementById('id_img_last_bot').src = \"" $this->Ini->path_botoes "/" $this->arr_buttons['bcons_final']['image'] . "\";\r\n");
  6374.                    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6375.                    {
  6376.                        $this->Ini->Arr_result['setSrc'][] = array('field' => 'id_img_last_bot''value' => $this->Ini->path_botoes "/" $this->arr_buttons['bcons_final']['image']);
  6377.                    }
  6378.                } 
  6379.            } 
  6380.        } 
  6381.        $nm_saida->saida("   nm_gp_fim = \"fim\";\r\n");
  6382.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6383.        {
  6384.            $this->Ini->Arr_result['setVar'][] = array('var' => 'nm_gp_fim''value' => "fim");
  6385.            $this->Ini->Arr_result['scrollEOF'] = true;
  6386.        }
  6387.    }
  6388.    else
  6389.    {
  6390.        $nm_saida->saida("   nm_gp_fim = \"\";\r\n");
  6391.        if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6392.        {
  6393.            $this->Ini->Arr_result['setVar'][] = array('var' => 'nm_gp_fim''value' => "");
  6394.        }
  6395.    }
  6396.    if (isset($this->redir_modal) && !empty($this->redir_modal))
  6397.    {
  6398.        echo $this->redir_modal;
  6399.    }
  6400.    $nm_saida->saida("   </script>\r\n");
  6401.    if ($this->grid_emb_form || $this->grid_emb_form_full)
  6402.    {
  6403.        $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  6404.        $nm_saida->saida("      parent.scAjaxDetailHeight('grid_new', $(document).innerHeight());\r\n");
  6405.        $nm_saida->saida("   </script>\r\n");
  6406.    }
  6407.    $nm_saida->saida("   </HTML>\r\n");
  6408.  }
  6409. //--- 
  6410. //--- 
  6411.  function form_navegacao()
  6412.  {
  6413.    global
  6414.    $nm_saida$nm_url_saida;
  6415.    $str_pbfile $this->Ini->root $this->Ini->path_imag_temp '/sc_pb_' session_id() . '.tmp';
  6416.    $nm_saida->saida("   <form name=\"F3\" method=\"post\" \r\n");
  6417.    $nm_saida->saida("                     action=\"./\" \r\n");
  6418.    $nm_saida->saida("                     target=\"_self\" style=\"display: none\"> \r\n");
  6419.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_chave\" value=\"\"/>\r\n");
  6420.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"\"/>\r\n");
  6421.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_ordem\" value=\"\"/>\r\n");
  6422.    $nm_saida->saida("    <input type=\"hidden\" name=\"SC_lig_apl_orig\" value=\"grid_new\"/>\r\n");
  6423.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_parm_acum\" value=\"\"/>\r\n");
  6424.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_quant_linhas\" value=\"\"/>\r\n");
  6425.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_url_saida\" value=\"\"/>\r\n");
  6426.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_parms\" value=\"\"/>\r\n");
  6427.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_tipo_pdf\" value=\"\"/>\r\n");
  6428.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_outra_jan\" value=\"\"/>\r\n");
  6429.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_orig_pesq\" value=\"\"/>\r\n");
  6430.    $nm_saida->saida("    <input type=\"hidden\" name=\"SC_module_export\" value=\"\"/>\r\n");
  6431.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  6432.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/> \r\n");
  6433.    $nm_saida->saida("   </form> \r\n");
  6434.    $nm_saida->saida("   <form name=\"F4\" method=\"post\" \r\n");
  6435.    $nm_saida->saida("                     action=\"./\" \r\n");
  6436.    $nm_saida->saida("                     target=\"_self\" style=\"display: none\"> \r\n");
  6437.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"rec\"/>\r\n");
  6438.    $nm_saida->saida("    <input type=\"hidden\" name=\"rec\" value=\"\"/>\r\n");
  6439.    $nm_saida->saida("    <input type=\"hidden\" name=\"nm_call_php\" value=\"\"/>\r\n");
  6440.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  6441.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/> \r\n");
  6442.    $nm_saida->saida("   </form> \r\n");
  6443.    $nm_saida->saida("   <form name=\"F5\" method=\"post\" \r\n");
  6444.    $nm_saida->saida("                     action=\"grid_new_pesq.class.php\" \r\n");
  6445.    $nm_saida->saida("                     target=\"_self\" style=\"display: none\"> \r\n");
  6446.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  6447.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/> \r\n");
  6448.    $nm_saida->saida("   </form> \r\n");
  6449.    $nm_saida->saida("   <form name=\"F6\" method=\"post\" \r\n");
  6450.    $nm_saida->saida("                     action=\"./\" \r\n");
  6451.    $nm_saida->saida("                     target=\"_self\" style=\"display: none\"> \r\n");
  6452.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  6453.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/> \r\n");
  6454.    $nm_saida->saida("   </form> \r\n");
  6455.    $nm_saida->saida("   <form name=\"Fprint\" method=\"post\" \r\n");
  6456.    $nm_saida->saida("                     action=\"grid_new_iframe_prt.php\" \r\n");
  6457.    $nm_saida->saida("                     target=\"jan_print\" style=\"display: none\"> \r\n");
  6458.    $nm_saida->saida("    <input type=\"hidden\" name=\"path_botoes\" value=\"" $this->Ini->path_botoes "\"/> \r\n");
  6459.    $nm_saida->saida("    <input type=\"hidden\" name=\"opcao\" value=\"print\"/>\r\n");
  6460.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"print\"/>\r\n");
  6461.    $nm_saida->saida("    <input type=\"hidden\" name=\"tp_print\" value=\"RC\"/>\r\n");
  6462.    $nm_saida->saida("    <input type=\"hidden\" name=\"cor_print\" value=\"CO\"/>\r\n");
  6463.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"print\"/>\r\n");
  6464.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_tipo_print\" value=\"RC\"/>\r\n");
  6465.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_cor_print\" value=\"CO\"/>\r\n");
  6466.    $nm_saida->saida("    <input type=\"hidden\" name=\"SC_module_export\" value=\"\"/>\r\n");
  6467.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_password\" value=\"\"/>\r\n");
  6468.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  6469.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/> \r\n");
  6470.    $nm_saida->saida("   </form> \r\n");
  6471.    $nm_saida->saida("   <form name=\"Fexport\" method=\"post\" \r\n");
  6472.    $nm_saida->saida("                     action=\"./\" \r\n");
  6473.    $nm_saida->saida("                     target=\"_self\" style=\"display: none\"> \r\n");
  6474.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"\"/>\r\n");
  6475.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_tp_xls\" value=\"\"/>\r\n");
  6476.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_tot_xls\" value=\"\"/>\r\n");
  6477.    $nm_saida->saida("    <input type=\"hidden\" name=\"SC_module_export\" value=\"\"/>\r\n");
  6478.    $nm_saida->saida("    <input type=\"hidden\" name=\"nm_delim_line\" value=\"\"/>\r\n");
  6479.    $nm_saida->saida("    <input type=\"hidden\" name=\"nm_delim_col\" value=\"\"/>\r\n");
  6480.    $nm_saida->saida("    <input type=\"hidden\" name=\"nm_delim_dados\" value=\"\"/>\r\n");
  6481.    $nm_saida->saida("    <input type=\"hidden\" name=\"nm_label_csv\" value=\"\"/>\r\n");
  6482.    $nm_saida->saida("    <input type=\"hidden\" name=\"nm_xml_tag\" value=\"\"/>\r\n");
  6483.    $nm_saida->saida("    <input type=\"hidden\" name=\"nm_xml_label\" value=\"\"/>\r\n");
  6484.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_password\" value=\"\"/>\r\n");
  6485.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  6486.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"/> \r\n");
  6487.    $nm_saida->saida("   </form> \r\n");
  6488.    $nm_saida->saida("  <form name=\"Fdoc_word\" method=\"post\" \r\n");
  6489.    $nm_saida->saida("        action=\"./\" \r\n");
  6490.    $nm_saida->saida("        target=\"_self\"> \r\n");
  6491.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_opcao\" value=\"doc_word\"/> \r\n");
  6492.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_cor_word\" value=\"CO\"/> \r\n");
  6493.    $nm_saida->saida("    <input type=\"hidden\" name=\"SC_module_export\" value=\"\"/>\r\n");
  6494.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_password\" value=\"\"/>\r\n");
  6495.    $nm_saida->saida("    <input type=\"hidden\" name=\"nmgp_navegator_print\" value=\"\"/> \r\n");
  6496.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_init\" value=\"" NM_encode_input($this->Ini->sc_page) . "\"/> \r\n");
  6497.    $nm_saida->saida("    <input type=\"hidden\" name=\"script_case_session\" value=\"" NM_encode_input(session_id()) . "\"> \r\n");
  6498.    $nm_saida->saida("  </form> \r\n");
  6499.    $nm_saida->saida("   <script type=\"text/javascript\">\r\n");
  6500.    $nm_saida->saida("    document.Fdoc_word.nmgp_navegator_print.value = navigator.appName;\r\n");
  6501.    $nm_saida->saida("   function nm_gp_word_conf(cor, SC_module_export, password, ajax, str_type, bol_param)\r\n");
  6502.    $nm_saida->saida("   {\r\n");
  6503.    $nm_saida->saida("       if (\"S\" == ajax)\r\n");
  6504.    $nm_saida->saida("       {\r\n");
  6505.    $nm_saida->saida("           $('#TB_window').remove();\r\n");
  6506.    $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
  6507.    $nm_saida->saida("               nm_submit_modal(\"" $this->Ini->path_link "grid_new/grid_new_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\"+ str_type +\"&sAdd=__E__nmgp_cor_word=\" + cor + \"__E__SC_module_export=\" + SC_module_export + \"__E__nmgp_password=\" + password + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
  6508.    $nm_saida->saida("       }\r\n");
  6509.    $nm_saida->saida("       else\r\n");
  6510.    $nm_saida->saida("       {\r\n");
  6511.    $nm_saida->saida("           document.Fdoc_word.nmgp_cor_word.value = cor;\r\n");
  6512.    $nm_saida->saida("           document.Fdoc_word.nmgp_password.value = password;\r\n");
  6513.    $nm_saida->saida("           document.Fdoc_word.SC_module_export.value = SC_module_export;\r\n");
  6514.    $nm_saida->saida("           document.Fdoc_word.action = \"grid_new_export_ctrl.php\";\r\n");
  6515.    $nm_saida->saida("           document.Fdoc_word.submit();\r\n");
  6516.    $nm_saida->saida("       }\r\n");
  6517.    $nm_saida->saida("   }\r\n");
  6518.    $nm_saida->saida("   var obj_tr      = \"\";\r\n");
  6519.    $nm_saida->saida("   var css_tr      = \"\";\r\n");
  6520.    $nm_saida->saida("   var field_over  = " $this->NM_field_over ";\r\n");
  6521.    $nm_saida->saida("   var field_click = " $this->NM_field_click ";\r\n");
  6522.    $nm_saida->saida("   function over_tr(obj, class_obj)\r\n");
  6523.    $nm_saida->saida("   {\r\n");
  6524.    $nm_saida->saida("       if (field_over != 1)\r\n");
  6525.    $nm_saida->saida("       {\r\n");
  6526.    $nm_saida->saida("           return;\r\n");
  6527.    $nm_saida->saida("       }\r\n");
  6528.    $nm_saida->saida("       if (obj_tr == obj)\r\n");
  6529.    $nm_saida->saida("       {\r\n");
  6530.    $nm_saida->saida("           return;\r\n");
  6531.    $nm_saida->saida("       }\r\n");
  6532.    $nm_saida->saida("       obj.className = '" $this->css_scGridFieldOver "';\r\n");
  6533.    $nm_saida->saida("   }\r\n");
  6534.    $nm_saida->saida("   function out_tr(obj, class_obj)\r\n");
  6535.    $nm_saida->saida("   {\r\n");
  6536.    $nm_saida->saida("       if (field_over != 1)\r\n");
  6537.    $nm_saida->saida("       {\r\n");
  6538.    $nm_saida->saida("           return;\r\n");
  6539.    $nm_saida->saida("       }\r\n");
  6540.    $nm_saida->saida("       if (obj_tr == obj)\r\n");
  6541.    $nm_saida->saida("       {\r\n");
  6542.    $nm_saida->saida("           return;\r\n");
  6543.    $nm_saida->saida("       }\r\n");
  6544.    $nm_saida->saida("       obj.className = class_obj;\r\n");
  6545.    $nm_saida->saida("   }\r\n");
  6546.    $nm_saida->saida("   function click_tr(obj, class_obj)\r\n");
  6547.    $nm_saida->saida("   {\r\n");
  6548.    $nm_saida->saida("       if (field_click != 1)\r\n");
  6549.    $nm_saida->saida("       {\r\n");
  6550.    $nm_saida->saida("           return;\r\n");
  6551.    $nm_saida->saida("       }\r\n");
  6552.    $nm_saida->saida("       if (obj_tr != \"\")\r\n");
  6553.    $nm_saida->saida("       {\r\n");
  6554.    $nm_saida->saida("           obj_tr.className = css_tr;\r\n");
  6555.    $nm_saida->saida("       }\r\n");
  6556.    $nm_saida->saida("       css_tr        = class_obj;\r\n");
  6557.    $nm_saida->saida("       if (obj_tr == obj)\r\n");
  6558.    $nm_saida->saida("       {\r\n");
  6559.    $nm_saida->saida("           obj_tr     = '';\r\n");
  6560.    $nm_saida->saida("           return;\r\n");
  6561.    $nm_saida->saida("       }\r\n");
  6562.    $nm_saida->saida("       obj_tr        = obj;\r\n");
  6563.    $nm_saida->saida("       css_tr        = class_obj;\r\n");
  6564.    $nm_saida->saida("       obj.className = '" $this->css_scGridFieldClick "';\r\n");
  6565.    $nm_saida->saida("   }\r\n");
  6566.    if ($this->Rec_ini == 0)
  6567.    {
  6568.        $nm_saida->saida("   nm_gp_ini = \"ini\";\r\n");
  6569.    }
  6570.    else
  6571.    {
  6572.        $nm_saida->saida("   nm_gp_ini = \"\";\r\n");
  6573.    }
  6574.    $nm_saida->saida("   nm_gp_rec_ini = \"" $this->Rec_ini "\";\r\n");
  6575.    $nm_saida->saida("   nm_gp_rec_fim = \"" $this->Rec_fim "\";\r\n");
  6576.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  6577.    {
  6578.        if ($this->Rec_ini == 0)
  6579.        {
  6580.            $this->Ini->Arr_result['setVar'][] = array('var' => 'nm_gp_ini''value' => "ini");
  6581.        }
  6582.        else
  6583.        {
  6584.            $this->Ini->Arr_result['setVar'][] = array('var' => 'nm_gp_ini''value' => "");
  6585.        }
  6586.        $this->Ini->Arr_result['setVar'][] = array('var' => 'nm_gp_rec_ini''value' => $this->Rec_ini);
  6587.        $this->Ini->Arr_result['setVar'][] = array('var' => 'nm_gp_rec_fim''value' => $this->Rec_fim);
  6588.    }
  6589.    $nm_saida->saida("   function nm_gp_submit_rec(campo) \r\n");
  6590.    $nm_saida->saida("   { \r\n");
  6591.    $nm_saida->saida("      if (nm_gp_ini == \"ini\" && (campo == \"ini\" || campo == nm_gp_rec_ini)) \r\n");
  6592.    $nm_saida->saida("      { \r\n");
  6593.    $nm_saida->saida("          return; \r\n");
  6594.    $nm_saida->saida("      } \r\n");
  6595.    $nm_saida->saida("      if (nm_gp_fim == \"fim\" && (campo == \"fim\" || campo == nm_gp_rec_fim)) \r\n");
  6596.    $nm_saida->saida("      { \r\n");
  6597.    $nm_saida->saida("          return; \r\n");
  6598.    $nm_saida->saida("      } \r\n");
  6599.    $nm_saida->saida("      nm_gp_submit_ajax(\"rec\", campo); \r\n");
  6600.    $nm_saida->saida("   } \r\n");
  6601.    $nm_saida->saida("   function nm_gp_submit_qsearch(pos) \r\n");
  6602.    $nm_saida->saida("   { \r\n");
  6603.    $nm_saida->saida("      var out_qsearch = \"\";\r\n");
  6604.    $nm_saida->saida("       var ver_ch = eval('change_fast_' + pos);\r\n");
  6605.    $nm_saida->saida("       if (document.getElementById('SC_fast_search_' + pos).value == '' && ver_ch == '')\r\n");
  6606.    $nm_saida->saida("       { \r\n");
  6607.    $nm_saida->saida("           scJs_alert(\"" $this->Ini->Nm_lang['lang_srch_req_field'] . "\");\r\n");
  6608.    $nm_saida->saida("           document.getElementById('SC_fast_search_' + pos).focus();\r\n");
  6609.    $nm_saida->saida("           return false;\r\n");
  6610.    $nm_saida->saida("       } \r\n");
  6611.    $nm_saida->saida("       if (document.getElementById('SC_fast_search_' + pos).value == '__Clear_Fast__')\r\n");
  6612.    $nm_saida->saida("       { \r\n");
  6613.    $nm_saida->saida("           document.getElementById('SC_fast_search_' + pos).value = '';\r\n");
  6614.    $nm_saida->saida("       } \r\n");
  6615.    $nm_saida->saida("       out_qsearch = document.getElementById('fast_search_f0_' + pos).value;\r\n");
  6616.    $nm_saida->saida("       out_qsearch += \"_SCQS_\" + document.getElementById('cond_fast_search_f0_' + pos).value;\r\n");
  6617.    $nm_saida->saida("       out_qsearch += \"_SCQS_\" + document.getElementById('SC_fast_search_' + pos).value;\r\n");
  6618.    $nm_saida->saida("       out_qsearch = out_qsearch.replace(/[+]/g, \"__NM_PLUS__\");\r\n");
  6619.    $nm_saida->saida("       out_qsearch = out_qsearch.replace(/[&]/g, \"__NM_AMP__\");\r\n");
  6620.    $nm_saida->saida("       out_qsearch = out_qsearch.replace(/[%]/g, \"__NM_PRC__\");\r\n");
  6621.    $nm_saida->saida("       ajax_navigate('fast_search', out_qsearch); \r\n");
  6622.    $nm_saida->saida("   } \r\n");
  6623.    $nm_saida->saida("   function nm_gp_submit_ajax(opc, parm) \r\n");
  6624.    $nm_saida->saida("   { \r\n");
  6625.    $nm_saida->saida("      return ajax_navigate(opc, parm); \r\n");
  6626.    $nm_saida->saida("   } \r\n");
  6627.    $nm_saida->saida("   function nm_gp_submit2(campo) \r\n");
  6628.    $nm_saida->saida("   { \r\n");
  6629.    $nm_saida->saida("      nm_gp_submit_ajax(\"ordem\", campo); \r\n");
  6630.    $nm_saida->saida("   } \r\n");
  6631.    $nm_saida->saida("   function nm_gp_submit3(parms, parm_acum, opc, ancor) \r\n");
  6632.    $nm_saida->saida("   { \r\n");
  6633.    $nm_saida->saida("      document.F3.target               = \"_self\"; \r\n");
  6634.    $nm_saida->saida("      document.F3.nmgp_parms.value     = parms ;\r\n");
  6635.    $nm_saida->saida("      document.F3.nmgp_parm_acum.value = parm_acum ;\r\n");
  6636.    $nm_saida->saida("      document.F3.nmgp_opcao.value     = opc ;\r\n");
  6637.    $nm_saida->saida("      document.F3.nmgp_url_saida.value = \"\";\r\n");
  6638.    $nm_saida->saida("      document.F3.action               = \"./\"  ;\r\n");
  6639.    $nm_saida->saida("      if (ancor != null) {\r\n");
  6640.    $nm_saida->saida("         ajax_save_ancor(\"F3\", ancor);\r\n");
  6641.    $nm_saida->saida("      } else {\r\n");
  6642.    $nm_saida->saida("          document.F3.submit() ;\r\n");
  6643.    $nm_saida->saida("      } \r\n");
  6644.    $nm_saida->saida("   } \r\n");
  6645.    $nm_saida->saida("   function nm_open_export(arq_export) \r\n");
  6646.    $nm_saida->saida("   { \r\n");
  6647.    $nm_saida->saida("      window.location = arq_export;\r\n");
  6648.    $nm_saida->saida("   } \r\n");
  6649.    $nm_saida->saida("   function nm_submit_modal(parms, t_parent) \r\n");
  6650.    $nm_saida->saida("   { \r\n");
  6651.    $nm_saida->saida("      if (t_parent == 'S' && typeof parent.tb_show == 'function')\r\n");
  6652.    $nm_saida->saida("      { \r\n");
  6653.    $nm_saida->saida("           parent.tb_show('', parms, '');\r\n");
  6654.    $nm_saida->saida("      } \r\n");
  6655.    $nm_saida->saida("      else\r\n");
  6656.    $nm_saida->saida("      { \r\n");
  6657.    $nm_saida->saida("         tb_show('', parms, '');\r\n");
  6658.    $nm_saida->saida("      } \r\n");
  6659.    $nm_saida->saida("   } \r\n");
  6660.    $nm_saida->saida("   function nm_move(tipo) \r\n");
  6661.    $nm_saida->saida("   { \r\n");
  6662.    $nm_saida->saida("      document.F6.target = \"_self\"; \r\n");
  6663.    $nm_saida->saida("      document.F6.submit() ;\r\n");
  6664.    $nm_saida->saida("      return;\r\n");
  6665.    $nm_saida->saida("   } \r\n");
  6666.    $nm_saida->saida("   function nm_gp_move(x, y, z, p, g, crt, ajax, chart_level, page_break_pdf, SC_module_export, use_pass_pdf, pdf_all_cab, pdf_all_label, pdf_label_group, pdf_zip) \r\n");
  6667.    $nm_saida->saida("   { \r\n");
  6668.    $nm_saida->saida("       document.F3.action           = \"./\"  ;\r\n");
  6669.    $nm_saida->saida("       document.F3.nmgp_parms.value = \"SC_null\" ;\r\n");
  6670.    $nm_saida->saida("       document.F3.nmgp_orig_pesq.value = \"\" ;\r\n");
  6671.    $nm_saida->saida("       document.F3.nmgp_url_saida.value = \"\" ;\r\n");
  6672.    $nm_saida->saida("       document.F3.nmgp_opcao.value = x; \r\n");
  6673.    $nm_saida->saida("       document.F3.nmgp_outra_jan.value = \"\" ;\r\n");
  6674.    $nm_saida->saida("       document.F3.target = \"_self\"; \r\n");
  6675.    $nm_saida->saida("       if (y == 1) \r\n");
  6676.    $nm_saida->saida("       {\r\n");
  6677.    $nm_saida->saida("           document.F3.target = \"_blank\"; \r\n");
  6678.    $nm_saida->saida("       }\r\n");
  6679.    $nm_saida->saida("       if (\"busca\" == x)\r\n");
  6680.    $nm_saida->saida("       {\r\n");
  6681.    $nm_saida->saida("           document.F3.nmgp_orig_pesq.value = z; \r\n");
  6682.    $nm_saida->saida("           z = '';\r\n");
  6683.    $nm_saida->saida("       }\r\n");
  6684.    $nm_saida->saida("       if (z != null && z != '') \r\n");
  6685.    $nm_saida->saida("       { \r\n");
  6686.    $nm_saida->saida("           document.F3.nmgp_tipo_pdf.value = z; \r\n");
  6687.    $nm_saida->saida("       } \r\n");
  6688.    $nm_saida->saida("       if (\"xls\" == x)\r\n");
  6689.    $nm_saida->saida("       {\r\n");
  6690.    $nm_saida->saida("           document.F3.SC_module_export.value = z;\r\n");
  6691.    if (!extension_loaded("zip"))
  6692.    {
  6693.        $nm_saida->saida("           alert (\"" html_entity_decode($this->Ini->Nm_lang['lang_othr_prod_xtzp'], ENT_COMPAT$_SESSION['scriptcase']['charset']) . "\");\r\n");
  6694.        $nm_saida->saida("           return false;\r\n");
  6695.    } 
  6696.    $nm_saida->saida("       }\r\n");
  6697.    $nm_saida->saida("       if (\"xml\" == x)\r\n");
  6698.    $nm_saida->saida("       {\r\n");
  6699.    $nm_saida->saida("           document.F3.SC_module_export.value = z;\r\n");
  6700.    $nm_saida->saida("       }\r\n");
  6701.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_new_iframe_params'] = array(
  6702.        'str_tmp'          => $this->Ini->path_imag_temp,
  6703.        'str_prod'         => $this->Ini->path_prod,
  6704.        'str_btn'          => $this->Ini->Str_btn_css,
  6705.        'str_lang'         => $this->Ini->str_lang,
  6706.        'str_schema'       => $this->Ini->str_schema_all,
  6707.        'str_google_fonts' => $this->Ini->str_google_fonts,
  6708.    );
  6709.    $prep_parm_pdf "scsess?#?" session_id() . "?@?str_tmp?#?" $this->Ini->path_imag_temp "?@?str_prod?#?" $this->Ini->path_prod "?@?str_btn?#?" $this->Ini->Str_btn_css "?@?str_lang?#?" $this->Ini->str_lang "?@?str_schema?#?"  $this->Ini->str_schema_all "?@?script_case_init?#?" $this->Ini->sc_page "?@?script_case_session?#?" session_id() . "?@?pbfile?#?" $str_pbfile "?@?jspath?#?" $this->Ini->path_js "?@?sc_apbgcol?#?" $this->Ini->path_css "?#?";
  6710.    $Md5_pdf    "@SC_par@" NM_encode_input($this->Ini->sc_page) . "@SC_par@grid_new@SC_par@" md5($prep_parm_pdf);
  6711.    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Md5_pdf'][md5($prep_parm_pdf)] = $prep_parm_pdf;
  6712.    $nm_saida->saida("       if (\"pdf\" == x)\r\n");
  6713.    $nm_saida->saida("       {\r\n");
  6714.    $nm_saida->saida("           if (\"S\" == ajax)\r\n");
  6715.    $nm_saida->saida("           {\r\n");
  6716.    $nm_saida->saida("               $('#TB_window').remove();\r\n");
  6717.    $nm_saida->saida("               $('body').append(\"<div id='TB_window'></div>\");\r\n");
  6718.    $nm_saida->saida("               nm_submit_modal(\"" $this->Ini->path_link "grid_new/grid_new_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=pdf&sAdd=__E__nmgp_tipo_pdf=\" + z + \"__E__sc_parms_pdf=\" + p + \"__E__sc_create_charts=\" + crt + \"__E__sc_graf_pdf=\" + g + \"__E__chart_level=\" + chart_level + \"__E__page_break_pdf=\" + page_break_pdf + \"__E__SC_module_export=\" + SC_module_export + \"__E__use_pass_pdf=\" + use_pass_pdf + \"__E__pdf_all_cab=\" + pdf_all_cab + \"__E__pdf_all_label=\" +  pdf_all_label + \"__E__pdf_label_group=\" +  pdf_label_group + \"__E__pdf_zip=\" +  pdf_zip + \"&nm_opc=pdf&KeepThis=true&TB_iframe=true&modal=true\", '');\r\n");
  6719.    $nm_saida->saida("           }\r\n");
  6720.    $nm_saida->saida("           else\r\n");
  6721.    $nm_saida->saida("           {\r\n");
  6722.    $nm_saida->saida("               window.location = \"" $this->Ini->path_link "grid_new/grid_new_iframe.php?nmgp_parms=" $Md5_pdf "&sc_tp_pdf=\" + z + \"&sc_parms_pdf=\" + p + \"&sc_create_charts=\" + crt + \"&sc_graf_pdf=\" + g + '&chart_level=' + chart_level + '&page_break_pdf=' + page_break_pdf + '&SC_module_export=' + SC_module_export + '&use_pass_pdf=' + use_pass_pdf + '&pdf_all_cab=' + pdf_all_cab + '&pdf_all_label=' +  pdf_all_label + '&pdf_label_group=' +  pdf_label_group + '&pdf_zip=' +  pdf_zip;\r\n");
  6723.    $nm_saida->saida("           }\r\n");
  6724.    $nm_saida->saida("       }\r\n");
  6725.    $nm_saida->saida("       else\r\n");
  6726.    $nm_saida->saida("       {\r\n");
  6727.    $nm_saida->saida("           if ((x == 'igual' || x == 'edit') && NM_ancor_ult_lig != \"\")\r\n");
  6728.    $nm_saida->saida("           {\r\n");
  6729.    $nm_saida->saida("                ajax_save_ancor(\"F3\", NM_ancor_ult_lig);\r\n");
  6730.    $nm_saida->saida("                NM_ancor_ult_lig = \"\";\r\n");
  6731.    $nm_saida->saida("            } else {\r\n");
  6732.    $nm_saida->saida("                document.F3.submit() ;\r\n");
  6733.    $nm_saida->saida("            } \r\n");
  6734.    $nm_saida->saida("       }\r\n");
  6735.    $nm_saida->saida("   } \r\n");
  6736.    $nm_saida->saida("   function nm_gp_print_conf(tp, cor, SC_module_export, password, ajax, str_type, bol_param)\r\n");
  6737.    $nm_saida->saida("   {\r\n");
  6738.    $nm_saida->saida("       if (\"S\" == ajax)\r\n");
  6739.    $nm_saida->saida("       {\r\n");
  6740.    $nm_saida->saida("           $('#TB_window').remove();\r\n");
  6741.    $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
  6742.    $nm_saida->saida("               nm_submit_modal(\"" $this->Ini->path_link "grid_new/grid_new_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\"+ str_type +\"&sAdd=__E__nmgp_tipo_print=\" + tp + \"__E__cor_print=\" + cor + \"__E__SC_module_export=\" + SC_module_export + \"__E__nmgp_password=\" + password + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
  6743.    $nm_saida->saida("       }\r\n");
  6744.    $nm_saida->saida("       else\r\n");
  6745.    $nm_saida->saida("       {\r\n");
  6746.    $nm_saida->saida("           document.Fprint.tp_print.value = tp;\r\n");
  6747.    $nm_saida->saida("           document.Fprint.cor_print.value = cor;\r\n");
  6748.    $nm_saida->saida("           document.Fprint.nmgp_tipo_print.value = tp;\r\n");
  6749.    $nm_saida->saida("           document.Fprint.nmgp_cor_print.value = cor;\r\n");
  6750.    $nm_saida->saida("           document.Fprint.SC_module_export.value = SC_module_export;\r\n");
  6751.    $nm_saida->saida("           document.Fprint.nmgp_password.value = password;\r\n");
  6752.    $nm_saida->saida("           if (password != \"\")\r\n");
  6753.    $nm_saida->saida("           {\r\n");
  6754.    $nm_saida->saida("               document.Fprint.target = '_self';\r\n");
  6755.    $nm_saida->saida("               document.Fprint.action = \"grid_new_export_ctrl.php\";\r\n");
  6756.    $nm_saida->saida("           }\r\n");
  6757.    $nm_saida->saida("           else\r\n");
  6758.    $nm_saida->saida("           {\r\n");
  6759.    $nm_saida->saida("               window.open('','jan_print','location=no,menubar=no,resizable,scrollbars,status=no,toolbar=no');\r\n");
  6760.    $nm_saida->saida("           }\r\n");
  6761.    $nm_saida->saida("           document.Fprint.submit() ;\r\n");
  6762.    $nm_saida->saida("       }\r\n");
  6763.    $nm_saida->saida("   }\r\n");
  6764.    $nm_saida->saida("   function nm_gp_xls_conf(tp_xls, SC_module_export, password, tot_xls, ajax, str_type, bol_param)\r\n");
  6765.    $nm_saida->saida("   {\r\n");
  6766.    $nm_saida->saida("       if (\"S\" == ajax)\r\n");
  6767.    $nm_saida->saida("       {\r\n");
  6768.    $nm_saida->saida("           $('#TB_window').remove();\r\n");
  6769.    $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
  6770.    $nm_saida->saida("               nm_submit_modal(\"" $this->Ini->path_link "grid_new/grid_new_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\" + str_type +\"&sAdd=__E__SC_module_export=\" + SC_module_export + \"__E__nmgp_tp_xls=\" + tp_xls + \"__E__nmgp_tot_xls=\" + tot_xls + \"__E__nmgp_password=\" + password + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
  6771.    $nm_saida->saida("       }\r\n");
  6772.    $nm_saida->saida("       else\r\n");
  6773.    $nm_saida->saida("       {\r\n");
  6774.    $nm_saida->saida("           document.Fexport.nmgp_opcao.value = \"xls\";\r\n");
  6775.    $nm_saida->saida("           document.Fexport.nmgp_tp_xls.value = tp_xls;\r\n");
  6776.    $nm_saida->saida("           document.Fexport.nmgp_tot_xls.value = tot_xls;\r\n");
  6777.    $nm_saida->saida("           document.Fexport.nmgp_password.value = password;\r\n");
  6778.    $nm_saida->saida("           document.Fexport.SC_module_export.value = SC_module_export;\r\n");
  6779.    $nm_saida->saida("           document.Fexport.action = \"grid_new_export_ctrl.php\";\r\n");
  6780.    $nm_saida->saida("           document.Fexport.submit() ;\r\n");
  6781.    $nm_saida->saida("       }\r\n");
  6782.    $nm_saida->saida("   }\r\n");
  6783.    $nm_saida->saida("   function nm_gp_csv_conf(delim_line, delim_col, delim_dados, label_csv, SC_module_export, password, ajax, str_type, bol_param)\r\n");
  6784.    $nm_saida->saida("   {\r\n");
  6785.    $nm_saida->saida("       if (\"S\" == ajax)\r\n");
  6786.    $nm_saida->saida("       {\r\n");
  6787.    $nm_saida->saida("           $('#TB_window').remove();\r\n");
  6788.    $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
  6789.    $nm_saida->saida("               nm_submit_modal(\"" $this->Ini->path_link "grid_new/grid_new_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\" + str_type +\"&sAdd=__E__nm_delim_line=\" + delim_line + \"__E__nm_delim_col=\" + delim_col + \"__E__nm_delim_dados=\" + delim_dados + \"__E__nm_label_csv=\" + label_csv + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
  6790.    $nm_saida->saida("       }\r\n");
  6791.    $nm_saida->saida("       else\r\n");
  6792.    $nm_saida->saida("       {\r\n");
  6793.    $nm_saida->saida("           document.Fexport.nmgp_opcao.value = \"csv\";\r\n");
  6794.    $nm_saida->saida("           document.Fexport.nm_delim_line.value = delim_line;\r\n");
  6795.    $nm_saida->saida("           document.Fexport.nm_delim_col.value = delim_col;\r\n");
  6796.    $nm_saida->saida("           document.Fexport.nm_delim_dados.value = delim_dados;\r\n");
  6797.    $nm_saida->saida("           document.Fexport.nm_label_csv.value = label_csv;\r\n");
  6798.    $nm_saida->saida("           document.Fexport.nmgp_password.value = password;\r\n");
  6799.    $nm_saida->saida("           document.Fexport.SC_module_export.value = SC_module_export;\r\n");
  6800.    $nm_saida->saida("           document.Fexport.action = \"grid_new_export_ctrl.php\";\r\n");
  6801.    $nm_saida->saida("           document.Fexport.submit() ;\r\n");
  6802.    $nm_saida->saida("       }\r\n");
  6803.    $nm_saida->saida("   }\r\n");
  6804.    $nm_saida->saida("   function nm_gp_xml_conf(xml_tag, xml_label, SC_module_export, password, ajax, str_type, bol_param)\r\n");
  6805.    $nm_saida->saida("   {\r\n");
  6806.    $nm_saida->saida("       if (\"S\" == ajax)\r\n");
  6807.    $nm_saida->saida("       {\r\n");
  6808.    $nm_saida->saida("           $('#TB_window').remove();\r\n");
  6809.    $nm_saida->saida("           $('body').append(\"<div id='TB_window'></div>\");\r\n");
  6810.    $nm_saida->saida("               nm_submit_modal(\"" $this->Ini->path_link "grid_new/grid_new_export_email.php?script_case_init={$this->Ini->sc_page}&path_img={$this->Ini->path_img_global}&path_btn={$this->Ini->path_botoes}&sType=\" + str_type +\"&sAdd=__E__nm_xml_tag=\" + xml_tag + \"__E__nm_xml_label=\" + xml_label + \"&KeepThis=true&TB_iframe=true&modal=true\", bol_param);\r\n");
  6811.    $nm_saida->saida("       }\r\n");
  6812.    $nm_saida->saida("       else\r\n");
  6813.    $nm_saida->saida("       {\r\n");
  6814.    $nm_saida->saida("           document.Fexport.nmgp_opcao.value   = \"xml\";\r\n");
  6815.    $nm_saida->saida("           document.Fexport.nm_xml_tag.value   = xml_tag;\r\n");
  6816.    $nm_saida->saida("           document.Fexport.nm_xml_label.value = xml_label;\r\n");
  6817.    $nm_saida->saida("           document.Fexport.nmgp_password.value = password;\r\n");
  6818.    $nm_saida->saida("           document.Fexport.SC_module_export.value = SC_module_export;\r\n");
  6819.    $nm_saida->saida("           document.Fexport.action = \"grid_new_export_ctrl.php\";\r\n");
  6820.    $nm_saida->saida("           document.Fexport.submit() ;\r\n");
  6821.    $nm_saida->saida("       }\r\n");
  6822.    $nm_saida->saida("   }\r\n");
  6823.    $nm_saida->saida("   function nm_gp_rtf_conf()\r\n");
  6824.    $nm_saida->saida("   {\r\n");
  6825.    $nm_saida->saida("       document.Fexport.nmgp_opcao.value   = \"rtf\";\r\n");
  6826.    $nm_saida->saida("       document.Fexport.action = \"grid_new_export_ctrl.php\";\r\n");
  6827.    $nm_saida->saida("       document.Fexport.submit() ;\r\n");
  6828.    $nm_saida->saida("   }\r\n");
  6829.    $nm_saida->saida("   nm_img = new Image();\r\n");
  6830.    $nm_saida->saida("   function nm_mostra_img(imagem, altura, largura)\r\n");
  6831.    $nm_saida->saida("   {\r\n");
  6832.    $nm_saida->saida("       tb_show(\"\", imagem, \"\");\r\n");
  6833.    $nm_saida->saida("   }\r\n");
  6834.    $nm_saida->saida("   function nm_mostra_doc(campo1, campo2)\r\n");
  6835.    $nm_saida->saida("   {\r\n");
  6836.    $nm_saida->saida("       NovaJanela = window.open (campo2 + \"?nmgp_parms=\" + campo1, \"ScriptCase\", \"resizable\");\r\n");
  6837.    $nm_saida->saida("   }\r\n");
  6838.    $nm_saida->saida("   function nm_escreve_window()\r\n");
  6839.    $nm_saida->saida("   {\r\n");
  6840.    if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['form_psq_ret']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret']) )
  6841.    {
  6842.       $nm_saida->saida("      if (document.Fpesq.nm_ret_psq.value != \"\")\r\n");
  6843.       $nm_saida->saida("      {\r\n");
  6844.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_modal']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_modal'])
  6845.       {
  6846.          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['iframe_ret_cap']))
  6847.          {
  6848.              $Iframe_cap $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['iframe_ret_cap'];
  6849.              unset($_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_ret_cap']);
  6850.              $nm_saida->saida("           var Obj_Form  = parent.document.getElementById('" $Iframe_cap "').contentWindow.document." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['form_psq_ret'] . "." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret'] . ";\r\n");
  6851.              $nm_saida->saida("           var Obj_Form1 = parent.document.getElementById('" $Iframe_cap "').contentWindow.document." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['form_psq_ret'] . "." str_replace("_autocomp""_"$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret']) . ";\r\n");
  6852.              $nm_saida->saida("           var Obj_Doc   = parent.document.getElementById('" $Iframe_cap "').contentWindow;\r\n");
  6853.              $nm_saida->saida("           if (parent.document.getElementById('" $Iframe_cap "').contentWindow.document.getElementById(\"id_read_on_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret'] . "\"))\r\n");
  6854.              $nm_saida->saida("           {\r\n");
  6855.              $nm_saida->saida("               var Obj_Readonly = parent.document.getElementById('" $Iframe_cap "').contentWindow.document.getElementById(\"id_read_on_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret'] . "\");\r\n");
  6856.              $nm_saida->saida("           }\r\n");
  6857.          }
  6858.          else
  6859.          {
  6860.              $nm_saida->saida("          var Obj_Form  = parent.document." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['form_psq_ret'] . "." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret'] . ";\r\n");
  6861.              $nm_saida->saida("          var Obj_Form1 = parent.document." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['form_psq_ret'] . "." str_replace("_autocomp""_"$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret']) . ";\r\n");
  6862.              $nm_saida->saida("          var Obj_Doc   = parent;\r\n");
  6863.              $nm_saida->saida("          if (parent.document.getElementById(\"id_read_on_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret'] . "\"))\r\n");
  6864.              $nm_saida->saida("          {\r\n");
  6865.              $nm_saida->saida("              var Obj_Readonly = parent.document.getElementById(\"id_read_on_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret'] . "\");\r\n");
  6866.              $nm_saida->saida("          }\r\n");
  6867.          }
  6868.       }
  6869.       else
  6870.       {
  6871.           $nm_saida->saida("          var Obj_Form  = opener.document." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['form_psq_ret'] . "." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret'] . ";\r\n");
  6872.           $nm_saida->saida("          var Obj_Form1 = opener.document." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['form_psq_ret'] . "." str_replace("_autocomp""_"$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret']) . ";\r\n");
  6873.           $nm_saida->saida("          var Obj_Doc   = opener;\r\n");
  6874.           $nm_saida->saida("          if (opener.document.getElementById(\"id_read_on_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret'] . "\"))\r\n");
  6875.           $nm_saida->saida("          {\r\n");
  6876.           $nm_saida->saida("              var Obj_Readonly = opener.document.getElementById(\"id_read_on_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campo_psq_ret'] . "\");\r\n");
  6877.           $nm_saida->saida("          }\r\n");
  6878.       }
  6879.           $nm_saida->saida("          else\r\n");
  6880.           $nm_saida->saida("          {\r\n");
  6881.           $nm_saida->saida("              var Obj_Readonly = null;\r\n");
  6882.           $nm_saida->saida("          }\r\n");
  6883.       $nm_saida->saida("          if (Obj_Form.value != document.Fpesq.nm_ret_psq.value)\r\n");
  6884.       $nm_saida->saida("          {\r\n");
  6885.       $nm_saida->saida("              Obj_Form.value = document.Fpesq.nm_ret_psq.value;\r\n");
  6886.       $nm_saida->saida("              if (Obj_Form != Obj_Form1 && Obj_Form1)\r\n");
  6887.       $nm_saida->saida("              {\r\n");
  6888.       $nm_saida->saida("                  Obj_Form1.value = document.Fpesq.nm_ret_psq.value;\r\n");
  6889.       $nm_saida->saida("              }\r\n");
  6890.       $nm_saida->saida("              if (null != Obj_Readonly)\r\n");
  6891.       $nm_saida->saida("              {\r\n");
  6892.       $nm_saida->saida("                  Obj_Readonly.innerHTML = document.Fpesq.nm_ret_psq.value;\r\n");
  6893.       $nm_saida->saida("              }\r\n");
  6894.      if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['js_apos_busca']))
  6895.      {
  6896.       $nm_saida->saida("              if (Obj_Doc." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['js_apos_busca'] . ")\r\n");
  6897.       $nm_saida->saida("              {\r\n");
  6898.       $nm_saida->saida("                  Obj_Doc." $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['js_apos_busca'] . "();\r\n");
  6899.       $nm_saida->saida("              }\r\n");
  6900.       $nm_saida->saida("              else if (Obj_Form.onchange && Obj_Form.onchange != '')\r\n");
  6901.       $nm_saida->saida("              {\r\n");
  6902.       $nm_saida->saida("                  Obj_Form.onchange();\r\n");
  6903.       $nm_saida->saida("              }\r\n");
  6904.      }
  6905.      else
  6906.      {
  6907.       $nm_saida->saida("              if (Obj_Form.onchange && Obj_Form.onchange != '')\r\n");
  6908.       $nm_saida->saida("              {\r\n");
  6909.       $nm_saida->saida("                  Obj_Form.onchange();\r\n");
  6910.       $nm_saida->saida("              }\r\n");
  6911.      }
  6912.       $nm_saida->saida("          }\r\n");
  6913.       $nm_saida->saida("      }\r\n");
  6914.    }
  6915.    $nm_saida->saida("      document.F5.action = \"grid_new_fim.php\";\r\n");
  6916.    $nm_saida->saida("      document.F5.submit();\r\n");
  6917.    $nm_saida->saida("   }\r\n");
  6918.    $nm_saida->saida("   function nm_open_popup(parms)\r\n");
  6919.    $nm_saida->saida("   {\r\n");
  6920.    $nm_saida->saida("       NovaJanela = window.open (parms, '', 'resizable, scrollbars');\r\n");
  6921.    $nm_saida->saida("   }\r\n");
  6922.    if (($this->grid_emb_form || $this->grid_emb_form_full) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['reg_start']))
  6923.    {
  6924.        $nm_saida->saida("      parent.scAjaxDetailStatus('grid_new');\r\n");
  6925.        $nm_saida->saida("      parent.scAjaxDetailHeight('grid_new', $(document).innerHeight());\r\n");
  6926.    }
  6927.    $nm_saida->saida("   function process_hotkeys(hotkey)\r\n");
  6928.    $nm_saida->saida("   {\r\n");
  6929.    $nm_saida->saida("      if (hotkey == 'sys_format_pdf') { \r\n");
  6930.    $nm_saida->saida("         var output =  $('#pdf_top').click();\r\n");
  6931.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6932.    $nm_saida->saida("      }\r\n");
  6933.    $nm_saida->saida("      if (hotkey == 'sys_format_word') { \r\n");
  6934.    $nm_saida->saida("         var output =  $('#word_top').click();\r\n");
  6935.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6936.    $nm_saida->saida("      }\r\n");
  6937.    $nm_saida->saida("      if (hotkey == 'sys_format_xls') { \r\n");
  6938.    $nm_saida->saida("         var output =  $('#xls_top').click();\r\n");
  6939.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6940.    $nm_saida->saida("      }\r\n");
  6941.    $nm_saida->saida("      if (hotkey == 'sys_format_xml') { \r\n");
  6942.    $nm_saida->saida("         var output =  $('#xml_top').click();\r\n");
  6943.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6944.    $nm_saida->saida("      }\r\n");
  6945.    $nm_saida->saida("      if (hotkey == 'sys_format_csv') { \r\n");
  6946.    $nm_saida->saida("         var output =  $('#csv_top').click();\r\n");
  6947.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6948.    $nm_saida->saida("      }\r\n");
  6949.    $nm_saida->saida("      if (hotkey == 'sys_format_rtf') { \r\n");
  6950.    $nm_saida->saida("         var output =  $('#rtf_top').click();\r\n");
  6951.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6952.    $nm_saida->saida("      }\r\n");
  6953.    $nm_saida->saida("      if (hotkey == 'sys_format_imp') { \r\n");
  6954.    $nm_saida->saida("         var output =  $('#print_top').click();\r\n");
  6955.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6956.    $nm_saida->saida("      }\r\n");
  6957.    $nm_saida->saida("      if (hotkey == 'sys_format_fil') { \r\n");
  6958.    $nm_saida->saida("         var output =  $('#pesq_top').click();\r\n");
  6959.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6960.    $nm_saida->saida("      }\r\n");
  6961.    $nm_saida->saida("      if (hotkey == 'sys_format_res') { \r\n");
  6962.    $nm_saida->saida("         var output =  $('#res_top').click();\r\n");
  6963.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6964.    $nm_saida->saida("      }\r\n");
  6965.    $nm_saida->saida("      if (hotkey == 'sys_format_savegrid') { \r\n");
  6966.    $nm_saida->saida("         var output =  $('#save_grid_top').click();\r\n");
  6967.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6968.    $nm_saida->saida("      }\r\n");
  6969.    $nm_saida->saida("      if (hotkey == 'sys_format_webh') { \r\n");
  6970.    $nm_saida->saida("         var output =  $('#help_bot').click();\r\n");
  6971.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6972.    $nm_saida->saida("      }\r\n");
  6973.    $nm_saida->saida("      if (hotkey == 'sys_format_sai') { \r\n");
  6974.    $nm_saida->saida("         var output =  $('#sai_top').click();\r\n");
  6975.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6976.    $nm_saida->saida("      }\r\n");
  6977.    $nm_saida->saida("      if (hotkey == 'sys_format_ini') { \r\n");
  6978.    $nm_saida->saida("         var output =  $('#first_bot').click();\r\n");
  6979.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6980.    $nm_saida->saida("      }\r\n");
  6981.    $nm_saida->saida("      if (hotkey == 'sys_format_ret') { \r\n");
  6982.    $nm_saida->saida("         var output =  $('#back_bot').click();\r\n");
  6983.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6984.    $nm_saida->saida("      }\r\n");
  6985.    $nm_saida->saida("      if (hotkey == 'sys_format_ava') { \r\n");
  6986.    $nm_saida->saida("         var output =  $('#forward_bot').click();\r\n");
  6987.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6988.    $nm_saida->saida("      }\r\n");
  6989.    $nm_saida->saida("      if (hotkey == 'sys_format_fim') { \r\n");
  6990.    $nm_saida->saida("         var output =  $('#last_bot').click();\r\n");
  6991.    $nm_saida->saida("         return (0 < output.length);\r\n");
  6992.    $nm_saida->saida("      }\r\n");
  6993.    $nm_saida->saida("   return false;\r\n");
  6994.    $nm_saida->saida("   }\r\n");
  6995.    $nm_saida->saida("   </script>\r\n");
  6996.  }
  6997. }
  6998. ?>
Return
grid_new_grid_ltr.css
  1. .css_proprietarios_idproprietario_label {text-align:right;vertical-align:middle;justify-content:right;font-weight:bold;}
  2. .css_proprietarios_idproprietario_grid_line {vertical-align: top;text-align: right;}
  3. .css_proprietarios_nome_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  4. .css_proprietarios_nome_grid_line {vertical-align: top;text-align: left;}
  5. .css_proprietarios_sexo_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  6. .css_proprietarios_sexo_grid_line {vertical-align: top;text-align: left;}
  7. .css_proprietarios_cpf_label {text-align:right;vertical-align:middle;justify-content:right;font-weight:bold;}
  8. .css_proprietarios_cpf_grid_line {vertical-align: top;text-align: right;}
  9. .css_proprietarios_telefone_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  10. .css_proprietarios_telefone_grid_line {vertical-align: top;text-align: left;}
  11. .css_veiculos_idveiculos_label {text-align:right;vertical-align:middle;justify-content:right;font-weight:bold;}
  12. .css_veiculos_idveiculos_grid_line {vertical-align: top;text-align: right;}
  13. .css_veiculos_anomodelo_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  14. .css_veiculos_anomodelo_grid_line {vertical-align: top;text-align: left;}
  15. .css_veiculos_placa_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  16. .css_veiculos_placa_grid_line {vertical-align: top;text-align: left;}
  17. .css_proprietarios_endereco_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  18. .css_proprietarios_endereco_grid_line {vertical-align: top;text-align: left;}
Return
grid_new_grid_rtl.css
  1. .css_proprietarios_idproprietario_label {text-align:right;vertical-align:middle;justify-content:right;font-weight:bold;}
  2. .css_proprietarios_idproprietario_grid_line {vertical-align: top;text-align: right;}
  3. .css_proprietarios_nome_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  4. .css_proprietarios_nome_grid_line {vertical-align: top;text-align: right;}
  5. .css_proprietarios_sexo_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  6. .css_proprietarios_sexo_grid_line {vertical-align: top;text-align: right;}
  7. .css_proprietarios_cpf_label {text-align:right;vertical-align:middle;justify-content:right;font-weight:bold;}
  8. .css_proprietarios_cpf_grid_line {vertical-align: top;text-align: right;}
  9. .css_proprietarios_telefone_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  10. .css_proprietarios_telefone_grid_line {vertical-align: top;text-align: right;}
  11. .css_veiculos_idveiculos_label {text-align:right;vertical-align:middle;justify-content:right;font-weight:bold;}
  12. .css_veiculos_idveiculos_grid_line {vertical-align: top;text-align: right;}
  13. .css_veiculos_anomodelo_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  14. .css_veiculos_anomodelo_grid_line {vertical-align: top;text-align: right;}
  15. .css_veiculos_placa_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  16. .css_veiculos_placa_grid_line {vertical-align: top;text-align: right;}
  17. .css_proprietarios_endereco_label {text-align:left;vertical-align:middle;justify-content:left;font-weight:bold;}
  18. .css_proprietarios_endereco_grid_line {vertical-align: top;text-align: right;}
Return
grid_new_iframe.php
  1. <?php
  2. include_once('grid_new_session.php');
  3. @session_start() ;

  4. $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  5. //check tmp
  6. if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  7. {
  8.     $str_path_apl_url $_SERVER['PHP_SELF'];
  9.     $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  10.     $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  11.     $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  12.     /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  13. }
  14. if (!isset($_SESSION['sc_session']))
  15. {
  16.     $NM_dir_atual getcwd();
  17.     if (empty($NM_dir_atual))
  18.     {
  19.         $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  20.         $str_path_sys  str_replace("\\"'/'$str_path_sys);
  21.     }
  22.     else
  23.     {
  24.         $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  25.         $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  26.     }
  27.     $str_path_web    $_SERVER['PHP_SELF'];
  28.     $str_path_web    str_replace("\\"'/'$str_path_web);
  29.     $str_path_web    str_replace('//''/'$str_path_web);
  30.     $root            substr($str_path_sys0, -strlen($str_path_web));
  31.     if (is_file($root $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/sc_apl_default_Projeto7.txt"))
  32.     {
  33. ?>
  34. <html>
  35.  <body>
  36.   <form name="F0" method="post" action="./" target="_self" style="display: none"> 
  37.   </form>
  38.   <script language="javascript">
  39.     document.F0.submit();
  40.   </script>
  41.  </body>
  42. </html>
  43. <?php
  44.         exit;
  45.     }
  46. }
  47. ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  48. $oExportPdf = new grid_new_export_pdf;
  49. $oExportPdf->exportPdf();

  50. class grid_new_export_pdf {

  51. function exportPdf() {

  52. $aParams = array();
  53. if (isset($_POST['sc_tp_pdf']) || isset($_POST['nmgp_tipo_pdf'])) {
  54.     $prep $_POST;
  55. }
  56. elseif (isset($_GET['sc_tp_pdf']) || isset($_GET['nmgp_tipo_pdf'])) {
  57.     $prep $_GET;
  58. }
  59. else  {
  60.     exit;
  61. }
  62. foreach ($prep as $nmgp_var => $nmgp_val)
  63. {
  64.     if ($nmgp_var == "nmgp_parms" && substr($nmgp_val08) == "@SC_par@")
  65.     {
  66.         $SC_Ind_Val explode("@SC_par@"$nmgp_val);
  67.         if (count($SC_Ind_Val) == && isset($_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['Md5_pdf'][$SC_Ind_Val[3]]))
  68.         {
  69.             $nmgp_val $_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['Md5_pdf'][$SC_Ind_Val[3]];
  70.         }
  71.         else
  72.         {
  73.             echo "<html>";
  74.             echo "<body>";
  75.             echo "<table align=\"center\" width=\"100%\" border=1 height=\"50px\">";
  76.             echo "<tr>";
  77.             echo "   <td align=\"center\">";
  78.             echo "       <b><font size=4>Invalid Data</font>";
  79.             echo "   </b></td>";
  80.             echo " </tr>";
  81.             echo "</table>";
  82.             echo "</body>";
  83.             echo "</html>";
  84.             exit;
  85.         }
  86.     }
  87.     $aParams[$nmgp_var] = $nmgp_val;
  88. }
  89. if (isset($aParams['nmgp_parms'])) 

  90.     $todo  explode("?@?"$aParams['nmgp_parms']);
  91.     foreach ($todo as $param)
  92.     {
  93.         $cadapar explode("?#?"$param);
  94.         $tmp_p $cadapar[0];
  95.         $aParams[$tmp_p] = $cadapar[1];
  96.     }
  97. }
  98. if (!isset($aParams['SC_module_export'])) 

  99.     $aParams['SC_module_export'] = "";
  100. }

  101. $parms_pdf = (isset($aParams['sc_parms_pdf'])) ? $aParams['sc_parms_pdf'] : "";
  102. $graf_pdf  = (isset($aParams['sc_graf_pdf']))  ? $aParams['sc_graf_pdf']  : "";
  103. if (!function_exists("NM_is_utf8"))
  104. {
  105.     include_once("../_lib/lib/php/nm_utf8.php");
  106. }
  107. if (!function_exists("nmButtonOutput"))
  108. {
  109.     include_once("../_lib/lib/php/nm_gp_config_btn.php");
  110. }
  111. $STR_schema         '';
  112. $STR_tmp            '';
  113. $STR_prod           '';
  114. $STR_btn            '';
  115. $STR_lang           '';
  116. $str_google_fonts   '';
  117. if (isset($_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['grid_new_iframe_params']))
  118. {
  119.     $STR_schema         $_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['grid_new_iframe_params']['str_schema'];
  120.     $STR_tmp            $_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['grid_new_iframe_params']['str_tmp'];
  121.     $STR_prod           $_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['grid_new_iframe_params']['str_prod'];
  122.     $STR_btn            $_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['grid_new_iframe_params']['str_btn'];
  123.     $STR_lang           $_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['grid_new_iframe_params']['str_lang'];
  124.     $str_google_fonts   $_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['grid_new_iframe_params']['str_google_fonts'];
  125. }
  126. if (isset($aParams['sc_create_charts'])) {
  127.     $_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['skip_charts'] = 'N' == $aParams['sc_create_charts'];
  128. }
  129. if (isset($aParams['chart_level'])) {
  130.     $_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['chart_level'] = $aParams['chart_level'];
  131. }
  132. elseif (isset($_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['chart_level'])) {
  133.     unset($_SESSION['sc_session'][ $aParams['script_case_init'] ]['grid_new']['chart_level']);
  134. }
  135. if (isset($aParams['page_break_pdf']) && $aParams['page_break_pdf'] != "_NO_")
  136. {
  137.     $Arr_page_pdf explode("_BRK_"$aParams['page_break_pdf']);
  138.     foreach ($_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['Page_break_PDF'] as $cmp => $opt)
  139.     {
  140.         if (in_array($cmp$Arr_page_pdf))
  141.         {
  142.             $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['Page_break_PDF'][$cmp] = "S";
  143.         }
  144.         else
  145.         {
  146.             $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['Page_break_PDF'][$cmp] = "N";
  147.         }
  148.     }
  149. }
  150. $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['opc_pdf']['all_cab']     = (isset($aParams['pdf_all_cab']))     ? $aParams['pdf_all_cab']     : "S";
  151. $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['opc_pdf']['all_label']   = (isset($aParams['pdf_all_label']))   ? $aParams['pdf_all_label']   : "S";
  152. $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['opc_pdf']['label_group'] = (isset($aParams['pdf_label_group'])) ? $aParams['pdf_label_group'] : "N";
  153. $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['opc_pdf']['pdf_zip']     = (isset($aParams['pdf_zip']))         ? $aParams['pdf_zip']         : "N";
  154. $Nm_lang     = array();
  155. $this->path_botoes '../_lib/img';
  156. if (@is_file("../_lib/lang/" $STR_lang ".lang.php"))
  157. {
  158.     include("../_lib/lang/" $STR_lang ".lang.php");
  159. }
  160. else
  161. {
  162.     include("../_lib/lang/en_us.lang.php");
  163. }
  164. foreach ($this->Nm_lang as $ind => $dados)
  165. {
  166.    if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($ind))
  167.    {
  168.        $ind sc_convert_encoding($ind$_SESSION['scriptcase']['charset'], "UTF-8");
  169.        $this->Nm_lang[$ind] = $dados;
  170.    }
  171.    if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($dados))
  172.    {
  173.        $this->Nm_lang[$ind] = sc_convert_encoding($dados$_SESSION['scriptcase']['charset'], "UTF-8");
  174.    }
  175. }
  176. $Nm_lang $this->Nm_lang;
  177. $_str_btn_file '../_lib/buttons/' str_replace('.css'$_SESSION['scriptcase']['reg_conf']['css_dir'] . '.php'$STR_btn);
  178. if (@is_file($_str_btn_file))
  179. {
  180.     include_once($_str_btn_file);
  181. }
  182. ?>
  183. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  184.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  185. <html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  186. <head>
  187.  <title><?php echo $Nm_lang['lang_othr_grid_title'?>  :: PDF</title>
  188.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  189. <?php
  190.  if ($_SESSION['scriptcase']['proc_mobile'])
  191.  {
  192. ?>
  193.     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  194. <?php
  195.  }
  196. ?>
  197.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  198.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $STR_schema?>_export.css" /> 
  199.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $STR_schema?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  200.  <link rel="stylesheet" href="<?php echo $STR_prod ?>/third/font-awesome/css/all.min.css" type="text/css" media="screen" />
  201.  <?php
  202.  if(isset($str_google_fonts) && !empty($str_google_fonts))
  203.  {
  204.  ?>
  205.     <link rel='stylesheet' type='text/css' href='<?php echo $str_google_fonts ?>' />
  206.  <?php
  207.  }
  208.  ?>
  209.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $STR_btn?>" /> 
  210.  <script type="text/javascript" src="<?php echo $STR_prod?>/third/jquery/js/jquery.js"></script>
  211.  <script type="text/javascript">
  212.  function viewClick() {
  213.   if ($("#idBtnView").prop("disabled")) {
  214.    return;
  215.   }
  216.   document.Fview.submit()
  217.  }
  218.  function downloadClick() {
  219.   if ($("#idBtnDown").prop("disabled")) {
  220.    return;
  221.   }
  222.   document.Fdown.submit()
  223.  }
  224.  function buttonDisable(buttonId) {
  225.   $("#" + buttonId).prop("disabled", true).addClass("disabled");
  226.  }
  227.  function buttonEnable(buttonId) {
  228.   $("#" + buttonId).prop("disabled", false).removeClass("disabled");
  229.  }
  230.  function checkPDF() {
  231.   $.get(nm_url_rand("grid_new_gauge_ctrl.php"), {
  232.    pbfile    : "<?php echo base64_encode($aParams['pbfile']) ?>",
  233.    sc_apbgcol: "<?php echo NM_encode_input($aParams['sc_apbgcol']) ?>",
  234.    str_lang  : "<?php echo base64_encode($aParams['str_lang']); ?>",
  235.    str_schema: "<?php echo $STR_schema ?>"
  236.   },
  237.   function (data){
  238.    var aInfo = data.split("!#!");
  239.    if (4 == aInfo.length) {
  240.     var iSize = aInfo[0],
  241.         iStep = aInfo[1],
  242.         iEnd  = aInfo[2],
  243.         sMsg  = aInfo[3],
  244.         iPerc = Math.floor((iStep * 95) / iSize);
  245.     if (1 == iEnd) {
  246.      iPerc = 100;
  247.     }
  248.     if (1 <= iPerc) {
  249.      $("#idPbarDone").css("display", "");
  250.     }
  251.     $("#idMessage").html(sMsg);
  252.     $("#idPbarDone").css("width", iPerc + "%");
  253.     $("#idPbarRest").css("width", (100 - iPerc) + "%");
  254.     if (1 == iEnd) {
  255.      buttonEnable("idBtnView");
  256.      buttonEnable("idBtnDown");
  257.      $("#idPbarRest").css("display", "none");
  258.      return;
  259.     }
  260.    }
  261.    setTimeout("checkPDF()", 1000);
  262.   });
  263.  }
  264.  function nm_url_rand(v_str_url)
  265.  {
  266.   str_chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  267.   str_rand  = v_str_url;
  268.   str_rand += (-1 == v_str_url.indexOf('?')) ? '?' : '&';
  269.   str_rand += 'r=';
  270.   for (i = 0; i < 8; i++)
  271.   {
  272.    str_rand += str_chars.charAt(Math.round(str_chars.length * Math.random()));
  273.   }
  274.   return str_rand;
  275.  }
  276.  </script>
  277. </head>
  278. <body class="scExportPage">
  279. <?php
  280. $NM_pdfbase = (isset($_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['pdf_name'])) ? $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['pdf_name'] : 'sc_pdf_' date('YmdHis') . '_' rand(01000) . '_grid_new.pdf';
  281. $NM_tit_doc = (isset($_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['pdf_name'])) ? $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['pdf_name'] : "grid_new.pdf";
  282. $NM_pdf_output $NM_pdfbase;
  283. if (isset($_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['opc_pdf']['pdf_zip']) && $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new']['opc_pdf']['pdf_zip'] == "S")
  284.  {
  285.     $NM_pdf_output str_replace(".pdf"".zip"$NM_pdf_output);
  286.     $NM_tit_doc    str_replace(".pdf"".zip"$NM_tit_doc);
  287.  }
  288. $NM_pdfurl  $STR_tmp;
  289. $NM_target  "_self";
  290. $path_doc_md5 md5($NM_pdfurl "/" $NM_pdf_output);
  291. $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new'][$path_doc_md5][0] = $NM_pdfurl "/" $NM_pdf_output;
  292. $_SESSION['sc_session'][$aParams['script_case_init']]['grid_new'][$path_doc_md5][1] = $NM_tit_doc;
  293. $NM_volta   "volta_grid";
  294. $NM_volta   = (!isset($aParams['nmgp_opcao']) || 'pdf_res' != $aParams['nmgp_opcao']) ? "volta_grid" "resumo";
  295. ?>
  296. <form name="F0" method="post" action="./" target="<?php echo $NM_target?>" style="display: none"> 
  297. <input type="hidden" name="nmgp_opcao" value="<?php echo NM_encode_input($NM_volta); ?>"> 
  298. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($aParams['script_case_init']); ?>"> 
  299. <input type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  300. </form>
  301. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  302. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($aParams['script_case_init']); ?>"> 
  303. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  304. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  305. </form>
  306. <form name="Fview" method="get" action="<?php echo $NM_pdfurl "/" $NM_pdf_output;?>" target="_blank" style="display: none"> 
  307. </form>
  308. <table style="border-collapse: collapse; border-width: 0; height: 98%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  309.  <?php
  310.    $file_to_test $_SESSION['sc_session']['real_path_third'] . '/wkhtmltopdf';
  311.    if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  312.    {
  313.        $file_to_test .= '/win/wkhtmltopdf.exe';
  314.    }
  315.    elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  316.    {
  317.        if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  318.        {
  319.            if (FALSE !== strpos(php_uname(), 'Debian 4.9')) 
  320.            {
  321.                $file_to_test .= '/stretch/';
  322.            }
  323.            else
  324.            {
  325.                $file_to_test .= '/linux-i386/';
  326.            }
  327.            $file_to_test .= 'wkhtmltopdf-i386';
  328.        }
  329.        else
  330.        {
  331.            if (FALSE !== strpos(php_uname(), 'Debian 4.9')) 
  332.            {
  333.                $file_to_test .= '/stretch/';
  334.            }
  335.            else
  336.            {
  337.                $file_to_test .= '/linux-amd64/';
  338.            }
  339.            $file_to_test .= 'wkhtmltopdf-amd64';
  340.        }
  341.    }
  342.    elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  343.    {
  344.        $file_to_test .= '/osx/Contents/MacOS/wkhtmltopdf';
  345.    }
  346.    if(!is_file($file_to_test))
  347.    {
  348.    ?>
  349.       <table class="scExportTable" align="center">
  350.        <tr>
  351.         <td class="scExportTitle" style="height: 25px"><?php echo $Nm_lang['lang_sweet_error']; ?></td>
  352.        </tr>
  353.        <tr>
  354.         <td class="scExportLine" style="width: 100%"><?php echo $Nm_lang['lang_pdff_errg_not_found']; ?></td>
  355.        </tr>
  356.       </table>
  357.    <?php
  358.    }
  359.    else
  360.    {
  361.  ?>
  362.  <table class="scExportTable" align="center">
  363.   <tr>
  364.    <td class="scExportTitle" style="height: 25px">PDF</td>
  365.   </tr>
  366.   <tr>
  367.    <td class="scExportLine" style="width: 100%">
  368.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td style="padding: 0; text-align: center" colspan="2">
  369.      <table class="scExportBar" style="width: 100%" align="center">
  370.       <tr>
  371.        <td class="scExportBarDone" style="width: 0; display: none" id="idPbarDone"></td>
  372.        <td class="scExportBarRest" style="width: 100%" id="idPbarRest"></td>
  373.       </tr>
  374.      </table>
  375.     </td></tr><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  376.     &nbsp;
  377.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  378.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""viewClick()""viewClick()""idBtnView"""""""""""""$this->path_botoes"""""""""""only_text""text_right""""""""""""""");
  379.  ?>
  380.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""downloadClick()""downloadClick()""idBtnDown"""""""""""""$this->path_botoes"""""""""""only_text""text_right""""""""""""""");
  381.  ?>
  382.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->path_botoes"""""""""""only_text""text_right""""""""""""""");
  383.  ?>
  384.     </td></tr></table>
  385. <?php
  386. if (!isset($aParams['nmgp_opcao']) || 'pdf_res' != $aParams['nmgp_opcao'])
  387. {
  388. ?>
  389. <iframe name="nmIfrPdf" height="1px" width="1px" frameborder="0" scrolling="no" allowtransparency="true" src="index.php?nmgp_opcao=pdf&script_case_init=<?php echo NM_encode_input($aParams['script_case_init']) ?>&script_case_session=<?php echo session_id() ?>&pbfile=<?php echo NM_encode_input($aParams['pbfile']) ?>&pdf_base=<?php echo str_replace("+""_NMPLUS_",$NM_pdfbase?>&pdf_url=<?php echo $NM_pdfurl ?>&sc_apbgcol=<?php echo NM_encode_input($aParams['sc_apbgcol']) ?>&nmgp_tipo_pdf=<?php echo NM_encode_input($aParams['sc_tp_pdf']) ?>&nmgp_parms_pdf=<?php echo $parms_pdf ?>&nmgp_graf_pdf=<?php echo $graf_pdf ?>&SC_module_export=<?php echo $aParams['SC_module_export'?>"></iframe>
  390. <?php
  391. }
  392. else
  393. {
  394. ?>
  395. <iframe name="nmIfrPdf" height="1px" width="1px" frameborder="0" scrolling="no" allowtransparency="true" src="index.php?nmgp_opcao=pdf_res&script_case_init=<?php echo NM_encode_input($aParams['script_case_init']) ?>&script_case_session=<?php echo session_id() ?>&pbfile=<?php echo NM_encode_input($aParams['pbfile']) ?>&pdf_base=<?php echo str_replace("+""_NMPLUS_",$NM_pdfbase?>&pdf_url=<?php echo $NM_pdfurl ?>&sc_apbgcol=<?php echo NM_encode_input($aParams['sc_apbgcol']) ?>&nmgp_tipo_pdf=<?php echo NM_encode_input($aParams['sc_tp_pdf']) ?>&nmgp_parms_pdf=<?php echo $parms_pdf ?>&nmgp_graf_pdf=<?php echo $graf_pdf ?>&SC_module_export=<?php echo $aParams['SC_module_export'?>"></iframe>
  396. <?php
  397. }
  398. ?>
  399.    </td>
  400.   </tr>
  401.  </table>
  402. </td></tr></table>
  403. <script>
  404.  $(function(){
  405.   buttonDisable("idBtnView");
  406.   buttonDisable("idBtnDown");
  407.   checkPDF();
  408.  });
  409. </script>
  410. <?PHP
  411. }
  412. ?>
  413. </body>
  414. </html>
  415. <?php
  416. }

  417. }

  418. ?>
Return
grid_new_iframe_prt.php
  1. <?php
  2.  @session_start();
  3. $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  4. //check tmp
  5. if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  6. {
  7.     $str_path_apl_url $_SERVER['PHP_SELF'];
  8.     $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  9.     $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  10.     $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  11.     /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  12. }
  13. if (!isset($_SESSION['sc_session']))
  14. {
  15.     $NM_dir_atual getcwd();
  16.     if (empty($NM_dir_atual))
  17.     {
  18.         $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  19.         $str_path_sys  str_replace("\\"'/'$str_path_sys);
  20.     }
  21.     else
  22.     {
  23.         $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  24.         $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  25.     }
  26.     $str_path_web    $_SERVER['PHP_SELF'];
  27.     $str_path_web    str_replace("\\"'/'$str_path_web);
  28.     $str_path_web    str_replace('//''/'$str_path_web);
  29.     $root            substr($str_path_sys0, -strlen($str_path_web));
  30.     if (is_file($root $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/sc_apl_default_Projeto7.txt"))
  31.     {
  32. ?>
  33. <html>
  34.  <body>
  35.   <form name="F0" method="post" action="./" target="_self" style="display: none"> 
  36.   </form>
  37.   <script language="javascript">
  38.     document.F0.submit();
  39.   </script>
  40.  </body>
  41. </html>
  42. <?php
  43.         exit;
  44.     }
  45. }
  46.  $script_case_init filter_input(INPUT_POST'script_case_init'FILTER_SANITIZE_NUMBER_INT);
  47.  $path_botoes      filter_input(INPUT_POST'path_botoes'FILTER_SANITIZE_STRING);
  48.  $apl_dependente   filter_input(INPUT_POST'apl_dependente'FILTER_SANITIZE_STRING);
  49.  $apl_opcao        = (isset($_POST['opcao'])) ? filter_input(INPUT_POST'opcao'FILTER_SANITIZE_STRING) : "print";
  50.  $SC_module_export = (isset($_POST['SC_module_export'])) ? filter_input(INPUT_POST'SC_module_export'FILTER_SANITIZE_STRING) : "n";
  51.  $apl_tipo_print   = (isset($_POST['tp_print']))         ? filter_input(INPUT_POST'tp_print'FILTER_SANITIZE_STRING)         : "PC";
  52.  $apl_cor_print    = (isset($_POST['cor_print']))        ? filter_input(INPUT_POST'cor_print'FILTER_SANITIZE_STRING)        : "PB";
  53.  $apl_saida        filter_input(INPUT_POST'apl_saida'FILTER_SANITIZE_STRING);
  54. ?>
  55. <html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  56.  <head>
  57.   <title>grid_new :: PRINT</title>
  58.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  59. <?php
  60.  if ($_SESSION['scriptcase']['proc_mobile'])
  61.  {
  62. ?>
  63.     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  64. <?php
  65.  }
  66. ?>
  67.   <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
  68.   <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?>" GMT">
  69.   <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
  70.   <META http-equiv="Cache-Control" content="post-check=0, pre-check=0">
  71.   <META http-equiv="Pragma" content="no-cache">
  72.   <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  73.  </head>
  74.  <body bgcolor="">
  75.   <form name="Fini" method="post" 
  76.         action="./" 
  77.         target="_self"> 
  78.     <input type="hidden" name="nmgp_opcao" value="<?php echo $apl_opcao;?>"/> 
  79.     <input type="hidden" name="nmgp_tipo_print" value="<?php echo $apl_tipo_print;?>"/> 
  80.     <input type="hidden" name="nmgp_cor_print" value="<?php echo $apl_cor_print;?>"/> 
  81.     <input type="hidden" name="nmgp_navegator_print" value=""/> 
  82.     <input type="hidden" name="SC_module_export" value="<?php echo $SC_module_export;?>"/> 
  83.     <input type="hidden" name="script_case_init" value="<?php echo $script_case_init ?>"/> 
  84.     <input type="hidden" name="script_case_session" value="<?php echo session_id() ?>"> 
  85.   </form> 
  86.  <script>
  87.     document.Fini.nmgp_navegator_print.value = navigator.appName;
  88.     document.Fini.submit();
  89.  </script>
  90.  </body>
  91. </html>
Return
grid_new_ini.txt
  1. index.php
  2. Projeto7
  3. grid_new
  4. NAO
  5. cons
  6. grid_new
  7. LigMd5
Return
grid_new_jquery.js
  1.   function nmAjaxRedir(oTemp)
  2.   {
  3.     if (oTemp && oTemp != null) {
  4.         oResp = oTemp;
  5.     }
  6.     if (!oResp["redirInfo"]) {
  7.       return;
  8.     }
  9.     sMetodo = oResp["redirInfo"]["metodo"];
  10.     sAction = oResp["redirInfo"]["action"];
  11.     if ("location" == sMetodo) {
  12.       if ("parent.parent" == oResp["redirInfo"]["target"]) {
  13.         parent.parent.location = sAction;
  14.       }
  15.       else if ("parent" == oResp["redirInfo"]["target"]) {
  16.         parent.location = sAction;
  17.       }
  18.       else if ("_blank" == oResp["redirInfo"]["target"]) {
  19.         window.open(sAction, "_blank");
  20.       }
  21.       else {
  22.         document.location = sAction;
  23.       }
  24.     }
  25.     else if ("html" == sMetodo) {
  26.         document.write(nmAjaxSpecCharParser(oResp["redirInfo"]["action"]));
  27.     }
  28.     else {
  29.       if (oResp["redirInfo"]["target"] == "modal") {
  30.           tb_show('', sAction + '?script_case_init=' +  oResp["redirInfo"]["script_case_init"] + '&script_case_session=' +  oResp["redirInfo"]["script_case_session"] + '&nmgp_parms=' + oResp["redirInfo"]["nmgp_parms"] + '&nmgp_outra_jan=true&nmgp_url_saida=modal&NMSC_modal=ok&TB_iframe=true&modal=true&height=' +  oResp["redirInfo"]["h_modal"] + '&width=' + oResp["redirInfo"]["w_modal"], '');
  31.           return;
  32.       }
  33.       sFormRedir = (oResp["redirInfo"]["nmgp_outra_jan"]) ? "form_ajax_redir_1" : "form_ajax_redir_2";
  34.       document.forms[sFormRedir].action           = sAction;
  35.       document.forms[sFormRedir].target           = oResp["redirInfo"]["target"];
  36.       document.forms[sFormRedir].nmgp_parms.value = oResp["redirInfo"]["nmgp_parms"];
  37.       if ("form_ajax_redir_1" == sFormRedir) {
  38.         document.forms[sFormRedir].nmgp_outra_jan.value = oResp["redirInfo"]["nmgp_outra_jan"];
  39.       }
  40.       else {
  41.         document.forms[sFormRedir].nmgp_url_saida.value   = oResp["redirInfo"]["nmgp_url_saida"];
  42.         document.forms[sFormRedir].script_case_init.value = oResp["redirInfo"]["script_case_init"];
  43.       }
  44.       document.forms[sFormRedir].submit();
  45.     }
  46.   }
  47. var json_err_crtl    = 1;
  48. var Id_Btn_selected  = new Array();
  49. var Css_Btn_selected = new Array();
  50. Id_Btn_selected[0] = "selcmp_top";
  51. Id_Btn_selected[1] = "ordcmp_top";
  52. Id_Btn_selected[2] = "sel_groupby_top";
  53. Id_Btn_selected[3] = "dynamic_search_top";
  54. function ajax_navigate(opc, parm)
  55. {
  56.     var scrollNavigateReload = false, extraParams = "", iEvt, iStart = 0;
  57.     for (ibtn = 0; ibtn < 4; ibtn++) {
  58.         Css_Btn_selected[ibtn] = $("#" + Id_Btn_selected[ibtn]).attr('class');
  59.     }
  60.     nmAjaxProcOn();
  61.     if (scrollNavigateReload) {
  62.       extraParams += "&scrollNavigateReload=Y";
  63.     }
  64.     if (typeof parm !== "string") {
  65.       parm = parm.toString();
  66.     }
  67.     parm = parm.replace(/[+]/g, "__NM_PLUS__");
  68.     while (parm.lastIndexOf("&amp;") != -1)
  69.     {
  70.        parm = parm.replace("&amp;" , "__NM_AMP__");
  71.     }
  72.     parm = parm.replace(/[&]/g, "__NM_AMP__");
  73.     parm = parm.replace(/[%]/g, "__NM_PRC__");
  74.     return new Promise(function(resolve, reject) {$.ajax({
  75.       type: "POST",
  76.       url: "index.php",
  77.       data: "nmgp_opcao=ajax_navigate&script_case_init=" + document.F4.script_case_init.value + "&script_case_session=" + document.F4.script_case_session.value + "&opc=" + opc  + "&parm=" + parm + extraParams
  78.      })
  79.      .fail(function(jqxhr, textStatus, error) {
  80.         var err = textStatus + ", " + error;
  81.         if (json_err_crtl == 1) {
  82.             json_err_crtl++;
  83.             ajax_navigate(opc, parm);
  84.         }
  85.         else {
  86.             nmAjaxProcOff();
  87.             json_err_crtl = 1;
  88.             alert (err);
  89.         }
  90.      })
  91.      .done(function(jsonNavigate) {
  92.         var i, oResp;
  93.         json_err_crtl = 1;
  94.         Tst_integrid = jsonNavigate.trim();
  95.         if ("{" != Tst_integrid.substr(0, 1)) {
  96.             nmAjaxProcOff();
  97.             alert (jsonNavigate);
  98.             return;
  99.         }
  100.         eval("oResp = " + jsonNavigate);
  101.         if (oResp["ss_time_out"]) {
  102.             nmAjaxProcOff();
  103.             nm_move();
  104.         }
  105.         if (oResp["redirInfo"]) {
  106.            nmAjaxRedir(oResp);
  107.         }
  108.         if (oResp["setValue"]) {
  109.           for (i = 0; i < oResp["setValue"].length; i++) {
  110.             $("#" + oResp["setValue"][i]["field"]).html(oResp["setValue"][i]["value"]);
  111.           }
  112.         }
  113.         if (oResp["setTitle"]) {
  114.           for (i = 0; i < oResp["setTitle"].length; i++) {
  115.             $("#" + oResp["setTitle"][i]["field"]).attr('title', oResp["setTitle"][i]["value"]);
  116.           }
  117.         }
  118.         if (oResp["setArr"]) {
  119.           for (i = 0; i < oResp["setArr"].length; i++) {
  120.                eval (oResp["setArr"][i]["var"] + ' = new Array()');
  121.           }
  122.         }
  123.         if (oResp["setVar"]) {
  124.           for (i = 0; i < oResp["setVar"].length; i++) {
  125.                eval (oResp["setVar"][i]["var"] + ' = \"' + oResp["setVar"][i]["value"] + '\"');
  126.           }
  127.         }
  128.         if (oResp["fillArr"]) {
  129.           for (i = 0; i < oResp["fillArr"].length; i++) {
  130.                eval (oResp["fillArr"][i]["var"] + ' = {' + oResp["fillArr"][i]["value"] + '}');
  131.           }
  132.         }
  133.         if (oResp["setDisplay"]) {
  134.           for (i = 0; i < oResp["setDisplay"].length; i++) {
  135.             if (document.getElementById(oResp["setDisplay"][i]["field"])) {
  136.               document.getElementById(oResp["setDisplay"][i]["field"]).style.display = oResp["setDisplay"][i]["value"];
  137.             }
  138.           }
  139.         }
  140.         if (oResp["setVisibility"]) {
  141.           for (i = 0; i < oResp["setVisibility"].length; i++) {
  142.             if (document.getElementById(oResp["setVisibility"][i]["field"])) {
  143.               document.getElementById(oResp["setVisibility"][i]["field"]).style.visibility = oResp["setVisibility"][i]["value"];
  144.             }
  145.           }
  146.         }
  147.         if (oResp["setDisabled"]) {
  148.           for (i = 0; i < oResp["setDisabled"].length; i++) {
  149.             if (document.getElementById(oResp["setDisabled"][i]["field"])) {
  150.               document.getElementById(oResp["setDisabled"][i]["field"]).disabled = oResp["setDisabled"][i]["value"];
  151.             }
  152.           }
  153.         }
  154.         if (oResp["setClass"]) {
  155.           for (i = 0; i < oResp["setClass"].length; i++) {
  156.             if (document.getElementById(oResp["setClass"][i]["field"])) {
  157.               document.getElementById(oResp["setClass"][i]["field"]).className = oResp["setClass"][i]["value"];
  158.             }
  159.           }
  160.         }
  161.         if (oResp["setSrc"]) {
  162.           for (i = 0; i < oResp["setSrc"].length; i++) {
  163.             if (document.getElementById(oResp["setSrc"][i]["field"])) {
  164.               document.getElementById(oResp["setSrc"][i]["field"]).src = oResp["setSrc"][i]["value"];
  165.             }
  166.           }
  167.         }
  168.         if (oResp["remove_Obj"]) {
  169.           for (i = 0; i < oResp["remove_Obj"].length; i++) {
  170.             if (document.getElementById(oResp["remove_Obj"][i])) {
  171.               document.getElementById(oResp["remove_Obj"][i]).remove();
  172.             }
  173.           }
  174.         }
  175.         if (oResp["redirInfo"]) {
  176.            nmAjaxRedir(oResp);
  177.         }
  178.         if (oResp["AlertJS"]) {
  179.           for (i = 0; i < oResp["AlertJS"].length; i++) {
  180.               jsAlertParams = oResp["AlertJSParam"][i] ? oResp["AlertJSParam"][i] : {};
  181.               scJs_alert (oResp["AlertJS"][i], jsAlertParams);
  182.           }
  183.         }
  184.         if (oResp["exec_JS"]) {
  185.           for (i = 0; i < oResp["exec_JS"].length; i++) {
  186.                eval (oResp["exec_JS"][i]["function"] + '("' + oResp["exec_JS"][i]["parm"] + '");');
  187.           }
  188.         }
  189.         if (oResp["grid_search_add"]) {
  190.           for (i = 0; i < oResp["grid_search_add"].length; i++) {
  191.                var parm = oResp["grid_search_add"][i]['field'];
  192.                Tot_obj_grid_search++;
  193.                Tab_obj_grid_search[Tot_obj_grid_search] = parm;
  194.                $(oResp["grid_search_add"][i]['tag']).insertBefore('#add_grid_search');
  195.                $('#grid_search_' + parm).attr('new', 'new');
  196.                scLoadScInput('#grid_search_' + parm + '_' + Tot_obj_grid_search + ' input:text.sc-js-input');
  197.           }
  198.           SC_carga_evt_jquery_grid('all');
  199.         }
  200.         if (oResp["htmOutput"]) {
  201.            nmAjaxShowDebug(oResp);
  202.         }
  203.         if (!SC_Link_View)
  204.         {
  205.             if (Qsearch_ok)
  206.             {
  207.                 scQSInitVal = $("#SC_fast_search_top").val();
  208.                 scQSInit = true;
  209.                 scQuickSearchInit(false, '');
  210.                 scQuickSearchKeyUp('top', null);
  211.                 scQSInit = false;
  212.             }
  213.             if (parm == "save_grid") {
  214.                 Dyn_Ini = true;
  215.             }
  216.             SC_init_jquery(false);
  217.             tb_init('a.thickbox, area.thickbox, input.thickbox');
  218.         }
  219.         for (ibtn = 0; ibtn < 4; ibtn++) {
  220.              $("#" + Id_Btn_selected[ibtn]).attr('class', Css_Btn_selected[ibtn]);
  221.         }
  222.         nmAjaxProcOff();
  223.         if (typeof(bootstrapMobile) === typeof(function(){})) bootstrapMobile();
  224.         resolve();
  225.             scSetFixedHeaders();
  226.     })});
  227. }
  228. function ajax_navigate_res(opc, parm)
  229. {
  230.     nmAjaxProcOn();
  231.     $.ajax({
  232.       type: "POST",
  233.       url: "index.php",
  234.       data: "nmgp_opcao=ajax_navigate&script_case_init=" + document.FRES.script_case_init.value + "&script_case_session=" + document.FRES.script_case_session.value + "&opc=" + opc  + "&parm=" + parm
  235.      })
  236.      .done(function(jsonNavigate) {
  237.         var i, oResp;
  238.         Tst_integrid = jsonNavigate.trim();
  239.         if ("{" != Tst_integrid.substr(0, 1)) {
  240.             nmAjaxProcOff();
  241.             alert (jsonNavigate);
  242.             return;
  243.         }
  244.         eval("oResp = " + jsonNavigate);
  245.         if (oResp["ss_time_out"]) {
  246.             nmAjaxProcOff();
  247.             nm_move();
  248.         }
  249.         if (oResp["redirInfo"]) {
  250.            nmAjaxRedir(oResp);
  251.         }
  252.         if (oResp["setValue"]) {
  253.           for (i = 0; i < oResp["setValue"].length; i++) {
  254.             $("#" + oResp["setValue"][i]["field"]).html(oResp["setValue"][i]["value"]);
  255.           }
  256.         }
  257.         if (oResp["setTitle"]) {
  258.           for (i = 0; i < oResp["setTitle"].length; i++) {
  259.             $("#" + oResp["setTitle"][i]["field"]).attr('title', oResp["setTitle"][i]["value"]);
  260.           }
  261.         }
  262.         if (oResp["setArr"]) {
  263.           for (i = 0; i < oResp["setArr"].length; i++) {
  264.                eval (oResp["setArr"][i]["var"] + ' = new Array()');
  265.           }
  266.         }
  267.         if (oResp["setVar"]) {
  268.           for (i = 0; i < oResp["setVar"].length; i++) {
  269.                eval (oResp["setVar"][i]["var"] + ' = \"' + oResp["setVar"][i]["value"] + '\"');
  270.           }
  271.         }
  272.         if (oResp["fillArr"]) {
  273.           for (i = 0; i < oResp["fillArr"].length; i++) {
  274.                eval (oResp["fillArr"][i]["var"] + ' = {' + oResp["fillArr"][i]["value"] + '}');
  275.           }
  276.         }
  277.         if (oResp["setDisplay"]) {
  278.           for (i = 0; i < oResp["setDisplay"].length; i++) {
  279.             if (document.getElementById(oResp["setDisplay"][i]["field"])) {
  280.               document.getElementById(oResp["setDisplay"][i]["field"]).style.display = oResp["setDisplay"][i]["value"];
  281.             }
  282.           }
  283.         }
  284.         if (oResp["setVisibility"]) {
  285.           for (i = 0; i < oResp["setVisibility"].length; i++) {
  286.             if (document.getElementById(oResp["setVisibility"][i]["field"])) {
  287.               document.getElementById(oResp["setVisibility"][i]["field"]).style.visibility = oResp["setVisibility"][i]["value"];
  288.             }
  289.           }
  290.         }
  291.         if (oResp["setDisabled"]) {
  292.           for (i = 0; i < oResp["setDisabled"].length; i++) {
  293.             if (document.getElementById(oResp["setDisabled"][i]["field"])) {
  294.               document.getElementById(oResp["setDisabled"][i]["field"]).disabled = oResp["setDisabled"][i]["value"];
  295.             }
  296.           }
  297.         }
  298.         if (oResp["setClass"]) {
  299.           for (i = 0; i < oResp["setClass"].length; i++) {
  300.             if (document.getElementById(oResp["setClass"][i]["field"])) {
  301.               document.getElementById(oResp["setClass"][i]["field"]).className = oResp["setClass"][i]["value"];
  302.             }
  303.           }
  304.         }
  305.         if (oResp["setSrc"]) {
  306.           for (i = 0; i < oResp["setSrc"].length; i++) {
  307.             if (document.getElementById(oResp["setSrc"][i]["field"])) {
  308.               document.getElementById(oResp["setSrc"][i]["field"]).src = oResp["setSrc"][i]["value"];
  309.             }
  310.           }
  311.         }
  312.         if (oResp["grid_search_add"]) {
  313.           for (i = 0; i < oResp["grid_search_add"].length; i++) {
  314.                var parm = oResp["grid_search_add"][i]['field'];
  315.                Tot_obj_grid_search++;
  316.                Tab_obj_grid_search[Tot_obj_grid_search] = parm;
  317.                $(oResp["grid_search_add"][i]['tag']).insertBefore('#add_grid_search');
  318.                $('#grid_search_' + parm).attr('new', 'new');
  319.                scLoadScInput('#grid_search_' + parm + '_' + Tot_obj_grid_search + ' input:text.sc-js-input');
  320.           }
  321.           SC_carga_evt_jquery_grid('all');
  322.         }
  323.         if (oResp["redirInfo"]) {
  324.            nmAjaxRedir(oResp);
  325.         }
  326.         if (oResp["AlertJS"]) {
  327.           for (i = 0; i < oResp["AlertJS"].length; i++) {
  328.               jsAlertParams = oResp["AlertJSParam"][i] ? oResp["AlertJSParam"][i] : {};
  329.               scJs_alert (oResp["AlertJS"][i], jsAlertParams);
  330.           }
  331.         }
  332.         if (oResp["htmOutput"]) {
  333.            nmAjaxShowDebug(oResp);
  334.         }
  335.         nmAjaxProcOff();
  336.         if (oResp["exec_script"]) {
  337.           for (i = 0; i < oResp["exec_script"].length; i++) {
  338.               eval (oResp["exec_script"][i]);
  339.           }
  340.         }
  341.     });
  342. }
  343. function ajax_add_grid_search(obj, str_origem, str_field)
  344. {
  345.     $(obj).parent().parent().remove();
  346.     
  347.     if($('#id_grid_search_all_cmp tr').length < 1)
  348.     {
  349.         $('#add_grid_search').addClass('scGridFilterTagAddDisabled');
  350.     }
  351.     else
  352.     {
  353.         $('#add_grid_search').removeClass('scGridFilterTagAddDisabled');
  354.     }
  355.     parm  = str_field;
  356.     nmAjaxProcOn();
  357.     Tot_obj_grid_search++;
  358.     Tab_obj_grid_search[Tot_obj_grid_search] = parm;
  359.     $.ajax({
  360.       type: "POST",
  361.       url: "index.php",
  362.       data: "nmgp_opcao=ajax_add_grid_search&script_case_init=" + document.Fgrid_search.script_case_init.value + "&script_case_session=" + document.Fgrid_search.script_case_session.value + "&parm=" + parm + "&seq=" + Tot_obj_grid_search + "&origem=" + str_origem
  363.      })
  364.      .done(function(jsonGrid_add) {
  365.         var i, oResp;
  366.         Tst_integrid = jsonGrid_add.trim();
  367.         if ("{" != Tst_integrid.substr(0, 1)) {
  368.             nmAjaxProcOff();
  369.             alert (jsonGrid_add);
  370.             return;
  371.         }
  372.         eval("oResp = " + jsonGrid_add);
  373.         if (oResp["ss_time_out"]) {
  374.             nmAjaxProcOff();
  375.             nm_move();
  376.         }
  377.         if (oResp["grid_add"]) {
  378.           for (i = 0; i < oResp["grid_add"].length; i++) {
  379.                $(oResp["grid_add"][i]).insertBefore('#add_grid_search');
  380.                $('#grid_search_' + parm).attr('new', 'new');
  381.                $('#grid_search_' + parm).find('.scGridFilterTagListItemLabel').click();
  382.                $('#grid_search_' + parm).find('input[type=text]').focus();
  383.           }
  384.         }
  385.         if (oResp["setVar"]) {
  386.           for (i = 0; i < oResp["setVar"].length; i++) {
  387.                eval (oResp["setVar"][i]["var"] + ' = \"' + oResp["setVar"][i]["value"] + '\"');
  388.           }
  389.         }
  390.         if (oResp["htmOutput"]) {
  391.            nmAjaxShowDebug(oResp);
  392.         }
  393.         SC_carga_evt_jquery_grid(Tot_obj_grid_search);
  394.         scLoadScInput('#grid_search_' + parm + '_' + Tot_obj_grid_search + ' input:text.sc-js-input');
  395.         nmAjaxProcOff();
  396.     });
  397. }
  398. function ajax_save_ancor(f_submit, ancor)
  399. {
  400.     nmAjaxProcOn();
  401.     $.ajax({
  402.       type: "POST",
  403.       url: "index.php",
  404.       data: "nmgp_opcao=ajax_save_ancor&script_case_init=" + document.F3.script_case_init.value + "&script_case_session=" + document.F3.script_case_session.value + "&ancor_save=" + ancor
  405.      })
  406.      .done(function(jsonSaveAncor) {
  407.         nmAjaxProcOff();
  408.         eval ("document." + f_submit + ".submit()");
  409.     });
  410. }
  411. var strPath         = '';
  412. var strTitle        = '';
  413. var showAjaxProcess = true;
  414. function ajax_export(tp_export, parms, strCallback, showAjax)
  415. {
  416.     strPath  = '';
  417.     strTitle  = '';
  418.     showAjaxProcess = showAjax;
  419.     if(showAjaxProcess)
  420.     {
  421.         nmAjaxProcOn();
  422.     }
  423.     $.ajax({
  424.       type: "POST",
  425.       url: "index.php",
  426.       data: "nmgp_opcao=ajax_export&export_opc=" + tp_export + parms + "&script_case_init=" + document.F3.script_case_init.value + "&script_case_session=" + document.F3.script_case_session.value,
  427.       complete: strCallback,
  428.      })
  429.      .done(function(jsonFile) {
  430.         var oResp;
  431.         Tst_integrid = jsonFile.trim();
  432.         if ("{" != Tst_integrid.substr(0, 1)) {
  433.             nmAjaxProcOff();
  434.             alert (jsonFile);
  435.             return;
  436.         }
  437.         eval("oResp = " + jsonFile);
  438.         if (oResp["ss_time_out"]) {
  439.             nmAjaxProcOff();
  440.             nm_move();
  441.         }
  442.         if (oResp["htmOutput"]) {
  443.            nmAjaxShowDebug(oResp);
  444.         }
  445.         if (oResp["file_export"]) {
  446.             strPath = oResp['file_export'];
  447.             strTitle = oResp['title_export'];
  448.         }
  449.         if(showAjaxProcess)
  450.         {
  451.             nmAjaxProcOff();
  452.         }
  453.     });
  454. }

Return
grid_new_json.php
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

  3. /**
  4.  * Converts to and from JSON format.
  5.  *
  6.  * JSON (JavaScript Object Notation) is a lightweight data-interchange
  7.  * format. It is easy for humans to read and write. It is easy for machines
  8.  * to parse and generate. It is based on a subset of the JavaScript
  9.  * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
  10.  * This feature can also be found in  Python. JSON is a text format that is
  11.  * completely language independent but uses conventions that are familiar
  12.  * to programmers of the C-family of languages, including C, C++, C#, Java,
  13.  * JavaScript, Perl, TCL, and many others. These properties make JSON an
  14.  * ideal data-interchange language.
  15.  *
  16.  * This package provides a simple encoder and decoder for JSON notation. It
  17.  * is intended for use with client-side Javascript applications that make
  18.  * use of HTTPRequest to perform server communication functions - data can
  19.  * be encoded into JSON notation for use in a client-side javascript, or
  20.  * decoded from incoming Javascript requests. JSON format is native to
  21.  * Javascript, and can be directly eval()'ed with no further parsing
  22.  * overhead
  23.  *
  24.  * All strings should be in ASCII or UTF-8 format!
  25.  *
  26.  * LICENSE: Redistribution and use in source and binary forms, with or
  27.  * without modification, are permitted provided that the following
  28.  * conditions are met: Redistributions of source code must retain the
  29.  * above copyright notice, this list of conditions and the following
  30.  * disclaimer. Redistributions in binary form must reproduce the above
  31.  * copyright notice, this list of conditions and the following disclaimer
  32.  * in the documentation and/or other materials provided with the
  33.  * distribution.
  34.  *
  35.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  36.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  37.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  38.  * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  39.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  40.  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  41.  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  42.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  43.  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  44.  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  45.  * DAMAGE.
  46.  *
  47.  * @category
  48.  * @package     Services_JSON
  49.  * @author      Michal Migurski <mike-json@teczno.com>
  50.  * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
  51.  * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
  52.  * @copyright   2005 Michal Migurski
  53.  * @version     CVS: $Id: json.php,v 1.1.1.1 2011-05-12 20:31:11 diogo Exp $
  54.  * @license     http://www.opensource.org/licenses/bsd-license.php
  55.  * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198
  56.  */

  57. /**
  58.  * Marker constant for Services_JSON::decode(), used to flag stack state
  59.  */
  60. define('SERVICES_JSON_SLICE',   1);

  61. /**
  62.  * Marker constant for Services_JSON::decode(), used to flag stack state
  63.  */
  64. define('SERVICES_JSON_IN_STR',  2);

  65. /**
  66.  * Marker constant for Services_JSON::decode(), used to flag stack state
  67.  */
  68. define('SERVICES_JSON_IN_ARR',  3);

  69. /**
  70.  * Marker constant for Services_JSON::decode(), used to flag stack state
  71.  */
  72. define('SERVICES_JSON_IN_OBJ',  4);

  73. /**
  74.  * Marker constant for Services_JSON::decode(), used to flag stack state
  75.  */
  76. define('SERVICES_JSON_IN_CMT'5);

  77. /**
  78.  * Behavior switch for Services_JSON::decode()
  79.  */
  80. define('SERVICES_JSON_LOOSE_TYPE'16);

  81. /**
  82.  * Behavior switch for Services_JSON::decode()
  83.  */
  84. define('SERVICES_JSON_SUPPRESS_ERRORS'32);

  85. /**
  86.  * Converts to and from JSON format.
  87.  *
  88.  * Brief example of use:
  89.  *
  90.  * <code>
  91.  * // create a new instance of Services_JSON
  92.  * $json = new Services_JSON();
  93.  *
  94.  * // convert a complexe value to JSON notation, and send it to the browser
  95.  * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
  96.  * $output = $json->encode($value);
  97.  *
  98.  * print($output);
  99.  * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
  100.  *
  101.  * // accept incoming POST data, assumed to be in JSON notation
  102.  * $input = file_get_contents('php://input', 1000000);
  103.  * $value = $json->decode($input);
  104.  * </code>
  105.  */
  106. class Services_JSON
  107. {
  108.    /**
  109.     * constructs a new JSON instance
  110.     *
  111.     * @param    int     $use    object behavior flags; combine with boolean-OR
  112.     *
  113.     *                           possible values:
  114.     *                           - SERVICES_JSON_LOOSE_TYPE:  loose typing.
  115.     *                                   "{...}" syntax creates associative arrays
  116.     *                                   instead of objects in decode().
  117.     *                           - SERVICES_JSON_SUPPRESS_ERRORS:  error suppression.
  118.     *                                   Values which can't be encoded (e.g. resources)
  119.     *                                   appear as NULL instead of throwing errors.
  120.     *                                   By default, a deeply-nested resource will
  121.     *                                   bubble up with an error, so all return values
  122.     *                                   from encode() should be checked with isError()
  123.     */
  124.     function __construct($use 0)
  125.     {
  126.         $this->use $use;
  127.     }

  128.    /**
  129.     * convert a string from one UTF-16 char to one UTF-8 char
  130.     *
  131.     * Normally should be handled by mb_convert_encoding, but
  132.     * provides a slower PHP-only method for installations
  133.     * that lack the multibye string extension.
  134.     *
  135.     * @param    string  $utf16  UTF-16 character
  136.     * @return   string  UTF-8 character
  137.     * @access   private
  138.     */
  139.     function utf162utf8($utf16)
  140.     {
  141.         // oh please oh please oh please oh please oh please
  142.         if(function_exists('mb_convert_encoding')) {
  143.             return mb_convert_encoding($utf16'UTF-8''UTF-16');
  144.         }

  145.         $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});

  146.         switch(true) {
  147.             case ((0x7F $bytes) == $bytes):
  148.                 // this case should never be reached, because we are in ASCII range
  149.                 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  150.                 return chr(0x7F $bytes);

  151.             case (0x07FF $bytes) == $bytes:
  152.                 // return a 2-byte UTF-8 character
  153.                 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  154.                 return chr(0xC0 | (($bytes >> 6) & 0x1F))
  155.                      . chr(0x80 | ($bytes 0x3F));

  156.             case (0xFFFF $bytes) == $bytes:
  157.                 // return a 3-byte UTF-8 character
  158.                 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  159.                 return chr(0xE0 | (($bytes >> 12) & 0x0F))
  160.                      . chr(0x80 | (($bytes >> 6) & 0x3F))
  161.                      . chr(0x80 | ($bytes 0x3F));
  162.         }

  163.         // ignoring UTF-32 for now, sorry
  164.         return '';
  165.     }

  166.    /**
  167.     * convert a string from one UTF-8 char to one UTF-16 char
  168.     *
  169.     * Normally should be handled by mb_convert_encoding, but
  170.     * provides a slower PHP-only method for installations
  171.     * that lack the multibye string extension.
  172.     *
  173.     * @param    string  $utf8   UTF-8 character
  174.     * @return   string  UTF-16 character
  175.     * @access   private
  176.     */
  177.     function utf82utf16($utf8)
  178.     {
  179.         // oh please oh please oh please oh please oh please
  180.         if(function_exists('mb_convert_encoding')) {
  181.             return mb_convert_encoding($utf8'UTF-16''UTF-8');
  182.         }

  183.         switch(strlen($utf8)) {
  184.             case 1:
  185.                 // this case should never be reached, because we are in ASCII range
  186.                 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  187.                 return $utf8;

  188.             case 2:
  189.                 // return a UTF-16 character from a 2-byte UTF-8 char
  190.                 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  191.                 return chr(0x07 & (ord($utf8{0}) >> 2))
  192.                      . chr((0xC0 & (ord($utf8{0}) << 6))
  193.                          | (0x3F ord($utf8{1})));

  194.             case 3:
  195.                 // return a UTF-16 character from a 3-byte UTF-8 char
  196.                 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  197.                 return chr((0xF0 & (ord($utf8{0}) << 4))
  198.                          | (0x0F & (ord($utf8{1}) >> 2)))
  199.                      . chr((0xC0 & (ord($utf8{1}) << 6))
  200.                          | (0x7F ord($utf8{2})));
  201.         }

  202.         // ignoring UTF-32 for now, sorry
  203.         return '';
  204.     }

  205.    /**
  206.     * encodes an arbitrary variable into JSON format
  207.     *
  208.     * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
  209.     *                           see argument 1 to Services_JSON() above for array-parsing behavior.
  210.     *                           if var is a strng, note that encode() always expects it
  211.     *                           to be in ASCII or UTF-8 format!
  212.     *
  213.     * @return   mixed   JSON string representation of input var or an error if a problem occurs
  214.     * @access   public
  215.     */
  216.     function encode($var)
  217.     {
  218.         switch (gettype($var)) {
  219.             case 'boolean':
  220.                 return $var 'true' 'false';

  221.             case 'NULL':
  222.                 return 'null';

  223.             case 'integer':
  224.                 return (int) $var;

  225.             case 'double':
  226.             case 'float':
  227.                 return (float) $var;

  228.             case 'string':
  229.                 // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
  230.                 $ascii '';
  231.                 $strlen_var strlen($var);

  232.                /*
  233.                 * Iterate over every character in the string,
  234.                 * escaping with a slash or encoding to UTF-8 where necessary
  235.                 */
  236.                 for ($c 0$c $strlen_var; ++$c) {

  237.                     $ord_var_c ord($var{$c});

  238.                     switch (true) {
  239.                         case $ord_var_c == 0x08:
  240.                             $ascii .= '\b';
  241.                             break;
  242.                         case $ord_var_c == 0x09:
  243.                             $ascii .= '\t';
  244.                             break;
  245.                         case $ord_var_c == 0x0A:
  246.                             $ascii .= '\n';
  247.                             break;
  248.                         case $ord_var_c == 0x0C:
  249.                             $ascii .= '\f';
  250.                             break;
  251.                         case $ord_var_c == 0x0D:
  252.                             $ascii .= '\r';
  253.                             break;

  254.                         case $ord_var_c == 0x22:
  255.                         case $ord_var_c == 0x2F:
  256.                         case $ord_var_c == 0x5C:
  257.                             // double quote, slash, slosh
  258.                             $ascii .= '\\'.$var{$c};
  259.                             break;

  260.                         case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
  261.                             // characters U-00000000 - U-0000007F (same as ASCII)
  262.                             $ascii .= $var{$c};
  263.                             break;

  264.                         case (($ord_var_c 0xE0) == 0xC0):
  265.                             // characters U-00000080 - U-000007FF, mask 110XXXXX
  266.                             // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  267.                             $char pack('C*'$ord_var_cord($var{$c 1}));
  268.                             $c += 1;
  269.                             $utf16 $this->utf82utf16($char);
  270.                             $ascii .= sprintf('\u%04s'bin2hex($utf16));
  271.                             break;

  272.                         case (($ord_var_c 0xF0) == 0xE0):
  273.                             // characters U-00000800 - U-0000FFFF, mask 1110XXXX
  274.                             // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  275.                             $char pack('C*'$ord_var_c,
  276.                                          ord($var{$c 1}),
  277.                                          ord($var{$c 2}));
  278.                             $c += 2;
  279.                             $utf16 $this->utf82utf16($char);
  280.                             $ascii .= sprintf('\u%04s'bin2hex($utf16));
  281.                             break;

  282.                         case (($ord_var_c 0xF8) == 0xF0):
  283.                             // characters U-00010000 - U-001FFFFF, mask 11110XXX
  284.                             // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  285.                             $char pack('C*'$ord_var_c,
  286.                                          ord($var{$c 1}),
  287.                                          ord($var{$c 2}),
  288.                                          ord($var{$c 3}));
  289.                             $c += 3;
  290.                             $utf16 $this->utf82utf16($char);
  291.                             $ascii .= sprintf('\u%04s'bin2hex($utf16));
  292.                             break;

  293.                         case (($ord_var_c 0xFC) == 0xF8):
  294.                             // characters U-00200000 - U-03FFFFFF, mask 111110XX
  295.                             // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  296.                             $char pack('C*'$ord_var_c,
  297.                                          ord($var{$c 1}),
  298.                                          ord($var{$c 2}),
  299.                                          ord($var{$c 3}),
  300.                                          ord($var{$c 4}));
  301.                             $c += 4;
  302.                             $utf16 $this->utf82utf16($char);
  303.                             $ascii .= sprintf('\u%04s'bin2hex($utf16));
  304.                             break;

  305.                         case (($ord_var_c 0xFE) == 0xFC):
  306.                             // characters U-04000000 - U-7FFFFFFF, mask 1111110X
  307.                             // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  308.                             $char pack('C*'$ord_var_c,
  309.                                          ord($var{$c 1}),
  310.                                          ord($var{$c 2}),
  311.                                          ord($var{$c 3}),
  312.                                          ord($var{$c 4}),
  313.                                          ord($var{$c 5}));
  314.                             $c += 5;
  315.                             $utf16 $this->utf82utf16($char);
  316.                             $ascii .= sprintf('\u%04s'bin2hex($utf16));
  317.                             break;
  318.                     }
  319.                 }

  320.                 return '"'.$ascii.'"';

  321.             case 'array':
  322.                /*
  323.                 * As per JSON spec if any array key is not an integer
  324.                 * we must treat the the whole array as an object. We
  325.                 * also try to catch a sparsely populated associative
  326.                 * array with numeric keys here because some JS engines
  327.                 * will create an array with empty indexes up to
  328.                 * max_index which can cause memory issues and because
  329.                 * the keys, which may be relevant, will be remapped
  330.                 * otherwise.
  331.                 *
  332.                 * As per the ECMA and JSON specification an object may
  333.                 * have any string as a property. Unfortunately due to
  334.                 * a hole in the ECMA specification if the key is a
  335.                 * ECMA reserved word or starts with a digit the
  336.                 * parameter is only accessible using ECMAScript's
  337.                 * bracket notation.
  338.                 */

  339.                 // treat as a JSON object
  340.                 if (is_array($var) && count($var) && (array_keys($var) !== range(0sizeof($var) - 1))) {
  341.                     $properties array_map(array($this'name_value'),
  342.                                             array_keys($var),
  343.                                             array_values($var));

  344.                     foreach($properties as $property) {
  345.                         if(Services_JSON::isError($property)) {
  346.                             return $property;
  347.                         }
  348.                     }

  349.                     return '{' join(','$properties) . '}';
  350.                 }

  351.                 // treat it like a regular array
  352.                 $elements array_map(array($this'encode'), $var);

  353.                 foreach($elements as $element) {
  354.                     if(Services_JSON::isError($element)) {
  355.                         return $element;
  356.                     }
  357.                 }

  358.                 return '[' join(','$elements) . ']';

  359.             case 'object':
  360.                 $vars get_object_vars($var);

  361.                 $properties array_map(array($this'name_value'),
  362.                                         array_keys($vars),
  363.                                         array_values($vars));

  364.                 foreach($properties as $property) {
  365.                     if(Services_JSON::isError($property)) {
  366.                         return $property;
  367.                     }
  368.                 }

  369.                 return '{' join(','$properties) . '}';

  370.             default:
  371.                 return ($this->use SERVICES_JSON_SUPPRESS_ERRORS)
  372.                     ? 'null'
  373.                     : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
  374.         }
  375.     }

  376.    /**
  377.     * array-walking function for use in generating JSON-formatted name-value pairs
  378.     *
  379.     * @param    string  $name   name of key to use
  380.     * @param    mixed   $value  reference to an array element to be encoded
  381.     *
  382.     * @return   string  JSON-formatted name-value pair, like '"name":value'
  383.     * @access   private
  384.     */
  385.     function name_value($name$value)
  386.     {
  387.         $encoded_value $this->encode($value);

  388.         if(Services_JSON::isError($encoded_value)) {
  389.             return $encoded_value;
  390.         }

  391.         return $this->encode(strval($name)) . ':' $encoded_value;
  392.     }

  393.    /**
  394.     * reduce a string by removing leading and trailing comments and whitespace
  395.     *
  396.     * @param    $str    string      string value to strip of comments and whitespace
  397.     *
  398.     * @return   string  string value stripped of comments and whitespace
  399.     * @access   private
  400.     */
  401.     function reduce_string($str)
  402.     {
  403.         $str preg_replace(array(

  404.                 // eliminate single line comments in '// ...' form
  405.                 '#^\s*//(.+)$#m',

  406.                 // eliminate multi-line comments in '/* ... */' form, at start of string
  407.                 '#^\s*/\*(.+)\*/#Us',

  408.                 // eliminate multi-line comments in '/* ... */' form, at end of string
  409.                 '#/\*(.+)\*/\s*$#Us'

  410.             ), ''$str);

  411.         // eliminate extraneous space
  412.         return trim($str);
  413.     }

  414.    /**
  415.     * decodes a JSON string into appropriate variable
  416.     *
  417.     * @param    string  $str    JSON-formatted string
  418.     *
  419.     * @return   mixed   number, boolean, string, array, or object
  420.     *                   corresponding to given JSON input string.
  421.     *                   See argument 1 to Services_JSON() above for object-output behavior.
  422.     *                   Note that decode() always returns strings
  423.     *                   in ASCII or UTF-8 format!
  424.     * @access   public
  425.     */
  426.     function decode($str)
  427.     {
  428.         $str $this->reduce_string($str);

  429.         switch (strtolower($str)) {
  430.             case 'true':
  431.                 return true;

  432.             case 'false':
  433.                 return false;

  434.             case 'null':
  435.                 return null;

  436.             default:
  437.                 $m = array();

  438.                 if (is_numeric($str)) {
  439.                     // Lookie-loo, it's a number

  440.                     // This would work on its own, but I'm trying to be
  441.                     // good about returning integers where appropriate:
  442.                     // return (float)$str;

  443.                     // Return float or int, as appropriate
  444.                     return ((float)$str == (integer)$str)
  445.                         ? (integer)$str
  446.                         : (float)$str;

  447.                 } elseif (preg_match('/^("|\').*(\1)$/s'$str$m) && $m[1] == $m[2]) {
  448.                     // STRINGS RETURNED IN UTF-8 FORMAT
  449.                     $delim substr($str01);
  450.                     $chrs substr($str1, -1);
  451.                     $utf8 '';
  452.                     $strlen_chrs strlen($chrs);

  453.                     for ($c 0$c $strlen_chrs; ++$c) {

  454.                         $substr_chrs_c_2 substr($chrs$c2);
  455.                         $ord_chrs_c ord($chrs{$c});

  456.                         switch (true) {
  457.                             case $substr_chrs_c_2 == '\b':
  458.                                 $utf8 .= chr(0x08);
  459.                                 ++$c;
  460.                                 break;
  461.                             case $substr_chrs_c_2 == '\t':
  462.                                 $utf8 .= chr(0x09);
  463.                                 ++$c;
  464.                                 break;
  465.                             case $substr_chrs_c_2 == '\n':
  466.                                 $utf8 .= chr(0x0A);
  467.                                 ++$c;
  468.                                 break;
  469.                             case $substr_chrs_c_2 == '\f':
  470.                                 $utf8 .= chr(0x0C);
  471.                                 ++$c;
  472.                                 break;
  473.                             case $substr_chrs_c_2 == '\r':
  474.                                 $utf8 .= chr(0x0D);
  475.                                 ++$c;
  476.                                 break;

  477.                             case $substr_chrs_c_2 == '\\"':
  478.                             case $substr_chrs_c_2 == '\\\'':
  479.                             case $substr_chrs_c_2 == '\\\\':
  480.                             case $substr_chrs_c_2 == '\\/':
  481.                                 if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
  482.                                    ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
  483.                                     $utf8 .= $chrs{++$c};
  484.                                 }
  485.                                 break;

  486.                             case preg_match('/\\\u[0-9A-F]{4}/i'substr($chrs$c6)):
  487.                                 // single, escaped unicode character
  488.                                 $utf16 chr(hexdec(substr($chrs, ($c 2), 2)))
  489.                                        . chr(hexdec(substr($chrs, ($c 4), 2)));
  490.                                 $utf8 .= $this->utf162utf8($utf16);
  491.                                 $c += 5;
  492.                                 break;

  493.                             case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
  494.                                 $utf8 .= $chrs{$c};
  495.                                 break;

  496.                             case ($ord_chrs_c 0xE0) == 0xC0:
  497.                                 // characters U-00000080 - U-000007FF, mask 110XXXXX
  498.                                 //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  499.                                 $utf8 .= substr($chrs$c2);
  500.                                 ++$c;
  501.                                 break;

  502.                             case ($ord_chrs_c 0xF0) == 0xE0:
  503.                                 // characters U-00000800 - U-0000FFFF, mask 1110XXXX
  504.                                 // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  505.                                 $utf8 .= substr($chrs$c3);
  506.                                 $c += 2;
  507.                                 break;

  508.                             case ($ord_chrs_c 0xF8) == 0xF0:
  509.                                 // characters U-00010000 - U-001FFFFF, mask 11110XXX
  510.                                 // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  511.                                 $utf8 .= substr($chrs$c4);
  512.                                 $c += 3;
  513.                                 break;

  514.                             case ($ord_chrs_c 0xFC) == 0xF8:
  515.                                 // characters U-00200000 - U-03FFFFFF, mask 111110XX
  516.                                 // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  517.                                 $utf8 .= substr($chrs$c5);
  518.                                 $c += 4;
  519.                                 break;

  520.                             case ($ord_chrs_c 0xFE) == 0xFC:
  521.                                 // characters U-04000000 - U-7FFFFFFF, mask 1111110X
  522.                                 // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  523.                                 $utf8 .= substr($chrs$c6);
  524.                                 $c += 5;
  525.                                 break;

  526.                         }

  527.                     }

  528.                     return $utf8;

  529.                 } elseif (preg_match('/^\[.*\]$/s'$str) || preg_match('/^\{.*\}$/s'$str)) {
  530.                     // array, or object notation

  531.                     if ($str{0} == '[') {
  532.                         $stk = array(SERVICES_JSON_IN_ARR);
  533.                         $arr = array();
  534.                     } else {
  535.                         if ($this->use SERVICES_JSON_LOOSE_TYPE) {
  536.                             $stk = array(SERVICES_JSON_IN_OBJ);
  537.                             $obj = array();
  538.                         } else {
  539.                             $stk = array(SERVICES_JSON_IN_OBJ);
  540.                             $obj = new stdClass();
  541.                         }
  542.                     }

  543.                     array_push($stk, array('what'  => SERVICES_JSON_SLICE,
  544.                                            'where' => 0,
  545.                                            'delim' => false));

  546.                     $chrs substr($str1, -1);
  547.                     $chrs $this->reduce_string($chrs);

  548.                     if ($chrs == '') {
  549.                         if (reset($stk) == SERVICES_JSON_IN_ARR) {
  550.                             return $arr;

  551.                         } else {
  552.                             return $obj;

  553.                         }
  554.                     }

  555.                     //print("\nparsing {$chrs}\n");

  556.                     $strlen_chrs strlen($chrs);

  557.                     for ($c 0$c <= $strlen_chrs; ++$c) {

  558.                         $top end($stk);
  559.                         $substr_chrs_c_2 substr($chrs$c2);

  560.                         if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
  561.                             // found a comma that is not inside a string, array, etc.,
  562.                             // OR we've reached the end of the character list
  563.                             $slice substr($chrs$top['where'], ($c $top['where']));
  564.                             array_push($stk, array('what' => SERVICES_JSON_SLICE'where' => ($c 1), 'delim' => false));
  565.                             //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");

  566.                             if (reset($stk) == SERVICES_JSON_IN_ARR) {
  567.                                 // we are in an array, so just push an element onto the stack
  568.                                 array_push($arr$this->decode($slice));

  569.                             } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
  570.                                 // we are in an object, so figure
  571.                                 // out the property name and set an
  572.                                 // element in an associative array,
  573.                                 // for now
  574.                                 $parts = array();

  575.                                 if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis'$slice$parts)) {
  576.                                     // "name":value pair
  577.                                     $key $this->decode($parts[1]);
  578.                                     $val $this->decode($parts[2]);

  579.                                     if ($this->use SERVICES_JSON_LOOSE_TYPE) {
  580.                                         $obj[$key] = $val;
  581.                                     } else {
  582.                                         $obj->$key $val;
  583.                                     }
  584.                                 } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis'$slice$parts)) {
  585.                                     // name:value pair, where name is unquoted
  586.                                     $key $parts[1];
  587.                                     $val $this->decode($parts[2]);

  588.                                     if ($this->use SERVICES_JSON_LOOSE_TYPE) {
  589.                                         $obj[$key] = $val;
  590.                                     } else {
  591.                                         $obj->$key $val;
  592.                                     }
  593.                                 }

  594.                             }

  595.                         } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
  596.                             // found a quote, and we are not inside a string
  597.                             array_push($stk, array('what' => SERVICES_JSON_IN_STR'where' => $c'delim' => $chrs{$c}));
  598.                             //print("Found start of string at {$c}\n");

  599.                         } elseif (($chrs{$c} == $top['delim']) &&
  600.                                  ($top['what'] == SERVICES_JSON_IN_STR) &&
  601.                                  ((strlen(substr($chrs0$c)) - strlen(rtrim(substr($chrs0$c), '\\'))) % != 1)) {
  602.                             // found a quote, we're in a string, and it's not escaped
  603.                             // we know that it's not escaped becase there is _not_ an
  604.                             // odd number of backslashes at the end of the string so far
  605.                             array_pop($stk);
  606.                             //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");

  607.                         } elseif (($chrs{$c} == '[') &&
  608.                                  in_array($top['what'], array(SERVICES_JSON_SLICESERVICES_JSON_IN_ARRSERVICES_JSON_IN_OBJ))) {
  609.                             // found a left-bracket, and we are in an array, object, or slice
  610.                             array_push($stk, array('what' => SERVICES_JSON_IN_ARR'where' => $c'delim' => false));
  611.                             //print("Found start of array at {$c}\n");

  612.                         } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
  613.                             // found a right-bracket, and we're in an array
  614.                             array_pop($stk);
  615.                             //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");

  616.                         } elseif (($chrs{$c} == '{') &&
  617.                                  in_array($top['what'], array(SERVICES_JSON_SLICESERVICES_JSON_IN_ARRSERVICES_JSON_IN_OBJ))) {
  618.                             // found a left-brace, and we are in an array, object, or slice
  619.                             array_push($stk, array('what' => SERVICES_JSON_IN_OBJ'where' => $c'delim' => false));
  620.                             //print("Found start of object at {$c}\n");

  621.                         } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
  622.                             // found a right-brace, and we're in an object
  623.                             array_pop($stk);
  624.                             //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");

  625.                         } elseif (($substr_chrs_c_2 == '/*') &&
  626.                                  in_array($top['what'], array(SERVICES_JSON_SLICESERVICES_JSON_IN_ARRSERVICES_JSON_IN_OBJ))) {
  627.                             // found a comment start, and we are in an array, object, or slice
  628.                             array_push($stk, array('what' => SERVICES_JSON_IN_CMT'where' => $c'delim' => false));
  629.                             $c++;
  630.                             //print("Found start of comment at {$c}\n");

  631.                         } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
  632.                             // found a comment end, and we're in one now
  633.                             array_pop($stk);
  634.                             $c++;

  635.                             for ($i $top['where']; $i <= $c; ++$i)
  636.                                 $chrs substr_replace($chrs' '$i1);

  637.                             //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");

  638.                         }

  639.                     }

  640.                     if (reset($stk) == SERVICES_JSON_IN_ARR) {
  641.                         return $arr;

  642.                     } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
  643.                         return $obj;

  644.                     }

  645.                 }
  646.         }
  647.     }

  648.     /**
  649.      * @todo Ultimately, this should just call PEAR::isError()
  650.      */
  651.     function isError($data$code null)
  652.     {
  653.         if (class_exists('pear')) {
  654.             return PEAR::isError($data$code);
  655.         } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
  656.                                  is_subclass_of($data'services_json_error'))) {
  657.             return true;
  658.         }

  659.         return false;
  660.     }
  661. }

  662. if (class_exists('PEAR_Error')) {

  663.     class Services_JSON_Error extends PEAR_Error
  664.     {
  665.         function __construct($message 'unknown error'$code null,
  666.                                      $mode null$options null$userinfo null)
  667.         {
  668.             parent::PEAR_Error($message$code$mode$options$userinfo);
  669.         }
  670.     }

  671. } else {

  672.     /**
  673.      * @todo Ultimately, this class shall be descended from PEAR_Error
  674.      */
  675.     class Services_JSON_Error
  676.     {
  677.         function __construct($message 'unknown error'$code null,
  678.                                      $mode null$options null$userinfo null)
  679.         {

  680.         }
  681.     }

  682. }

  683. ?>
Return
grid_new_lookup.class.php
  1. <?php
  2. class grid_new_lookup
  3. {
  4. }
  5. ?>
Return
grid_new_message.js
  1.   function nmAjaxMessage(oTemp)
  2.   {
  3.     if (oTemp && oTemp != null) {
  4.         oResp = oTemp;
  5.     }
  6.     if (oResp["ajaxMessage"] && oResp["ajaxMessage"]["message"] && "" != oResp["ajaxMessage"]["message"])
  7.     {
  8.       var sTitle    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["title"])        ? oResp["ajaxMessage"]["title"]               : scMsgDefTitle,
  9.           bModal    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["modal"])        ? ("Y" == oResp["ajaxMessage"]["modal"])      : false,
  10.           iTimeout  = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["timeout"])      ? parseInt(oResp["ajaxMessage"]["timeout"])   : 0,
  11.           bButton   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["button"])       ? ("Y" == oResp["ajaxMessage"]["button"])     : false,
  12.           sButton   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["button_label"]) ? oResp["ajaxMessage"]["button_label"]        : "Ok",
  13.           iTop      = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["top"])          ? parseInt(oResp["ajaxMessage"]["top"])       : 0,
  14.           iLeft     = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["left"])         ? parseInt(oResp["ajaxMessage"]["left"])      : 0,
  15.           iWidth    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["width"])        ? parseInt(oResp["ajaxMessage"]["width"])     : 0,
  16.           iHeight   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["height"])       ? parseInt(oResp["ajaxMessage"]["height"])    : 0,
  17.           bClose    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["show_close"])   ? ("Y" == oResp["ajaxMessage"]["show_close"]) : true,
  18.           bBodyIcon = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["body_icon"])    ? ("Y" == oResp["ajaxMessage"]["body_icon"])  : true,
  19.           sRedir    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["redir"])        ? oResp["ajaxMessage"]["redir"]               : "",
  20.           sTarget   = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["redir_target"]) ? oResp["ajaxMessage"]["redir_target"]        : "",
  21.           sParam    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["redir_par"])    ? oResp["ajaxMessage"]["redir_par"]           : "",
  22.           bToast    = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["toast"])        ? ("Y" == oResp["ajaxMessage"]["toast"])      : false,
  23.           sToastPos = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["toast_pos"])    ? oResp["ajaxMessage"]["toast_pos"]           : "",
  24.           sType     = (oResp["ajaxMessage"] && oResp["ajaxMessage"]["type"])         ? oResp["ajaxMessage"]["type"]                : "";
  25.       _nmAjaxShowMessage({title: sTitle, message: oResp["ajaxMessage"]["message"], isModal: bModal, timeout: iTimeout, showButton: bButton, buttonLabel: sButton, topPos: iTop, leftPos: iLeft, width: iWidth, height: iHeight, redirUrl: sRedir, redirTarget: sTarget, redirParam: sParam, showClose: bClose, showBodyIcon: bBodyIcon, isToast: bToast, toastPos: sToastPos, type: sType});
  26.     }
  27.   }
  28.   function _nmAjaxShowMessage_default(params) {
  29.     var sTitle = params["title"], sMessage = params["message"], bModal = params["isModal"], iTimeout = params["timeout"], bButton = params["showButton"], sButton = params["buttonLabel"], iTop = params["topPos"], iLeft = params["leftPos"], iWidth = params["width"], iHeight = params["height"], sRedir = params["redirUrl"], sTarget = params["redirTarget"], sParam = params["redirParam"], bClose = params["showClose"], bBodyIcon = params["showBodyIcon"];
  30.     if ("" == sMessage) {
  31.       if (bModal) {
  32.         scMsgDefClick = "close_modal";
  33.       }
  34.       else {
  35.         scMsgDefClick = "close";
  36.       }
  37.       _nmAjaxMessageBtnClick();
  38.       document.getElementById("id_message_display_title").innerHTML = scMsgDefTitle;
  39.       document.getElementById("id_message_display_text").innerHTML = "";
  40.       document.getElementById("id_message_display_buttone").value = scMsgDefButton;
  41.       document.getElementById("id_message_display_buttond").style.display = "none";
  42.     }
  43.     else {
  44.       document.getElementById("id_message_display_title").innerHTML = nmAjaxSpecCharParser(sTitle);
  45.       document.getElementById("id_message_display_text").innerHTML = nmAjaxSpecCharParser(sMessage);
  46.       document.getElementById("id_message_display_buttone").value = sButton;
  47.       document.getElementById("id_message_display_buttond").style.display = bButton ? "" : "none";
  48.       document.getElementById("id_message_display_buttond").style.display = bButton ? "" : "none";
  49.       document.getElementById("id_message_display_title_line").style.display = (bClose || "" != sTitle) ? "" : "none";
  50.       document.getElementById("id_message_display_close_icon").style.display = bClose ? "" : "none";
  51.       if (document.getElementById("id_message_display_body_icon")) {
  52.         document.getElementById("id_message_display_body_icon").style.display = bBodyIcon ? "" : "none";
  53.       }
  54.       $("#id_message_display_content").css('width', (0 < iWidth ? iWidth + 'px' : ''));
  55.       $("#id_message_display_content").css('height', (0 < iHeight ? iHeight + 'px' : ''));
  56.       if (bModal) {
  57.         iWidth = iWidth || 250;
  58.         iHeight = iHeight || 200;
  59.         scMsgDefClose = "close_modal";
  60.         tb_show('', '#TB_inline?height=' + (iHeight + 6) + '&width=' + (iWidth + 4) + '&inlineId=id_message_display_frame&modal=true', '');
  61.         if (bButton) {
  62.           if ("" != sRedir && "" != sTarget) {
  63.             scMsgDefClick = "redir2_modal";
  64.             document.form_ajax_redir_2.action = sRedir;
  65.             document.form_ajax_redir_2.target = sTarget;
  66.             document.form_ajax_redir_2.nmgp_parms.value = sParam;
  67.             document.form_ajax_redir_2.script_case_init.value = scMsgDefScInit;
  68.           }
  69.           else if ("" != sRedir && "" == sTarget) {
  70.             scMsgDefClick = "redir1";
  71.             document.form_ajax_redir_1.action = sRedir;
  72.             document.form_ajax_redir_1.nmgp_parms.value = sParam;
  73.           }
  74.           else {
  75.             scMsgDefClick = "close_modal";
  76.           }
  77.         }
  78.         else if (null != iTimeout && 0 < iTimeout) {
  79.           scMsgDefClick = "close_modal";
  80.           setTimeout("_nmAjaxMessageBtnClick()", iTimeout * 1000);
  81.         }
  82.       }
  83.       else
  84.       {
  85.         scMsgDefClose = "close";
  86.         $("#id_message_display_frame").css('top', (0 < iTop ? iTop + 'px' : ''));
  87.         $("#id_message_display_frame").css('left', (0 < iLeft ? iLeft + 'px' : ''));
  88.         document.getElementById("id_message_display_frame").style.display = "";
  89.         if (0 == iTop && 0 == iLeft) {
  90.           nmCenterElement(document.getElementById("id_message_display_frame"));
  91.         }
  92.         if (bButton) {
  93.           if ("" != sRedir && "" != sTarget) {
  94.             scMsgDefClick = "redir2";
  95.             document.form_ajax_redir_2.action = sRedir;
  96.             document.form_ajax_redir_2.target = sTarget;
  97.             document.form_ajax_redir_2.nmgp_parms.value = sParam;
  98.             document.form_ajax_redir_2.script_case_init.value = scMsgDefScInit;
  99.           }
  100.           else if ("" != sRedir && "" == sTarget) {
  101.             scMsgDefClick = "redir1";
  102.             document.form_ajax_redir_1.action = sRedir;
  103.             document.form_ajax_redir_1.nmgp_parms.value = sParam;
  104.           }
  105.           else {
  106.             scMsgDefClick = "close";
  107.           }
  108.         }
  109.         else if (null != iTimeout && 0 < iTimeout) {
  110.           scMsgDefClick = "close";
  111.           setTimeout("_nmAjaxMessageBtnClick()", iTimeout * 1000);
  112.         }
  113.       }
  114.     }
  115.   }
  116.   function _nmAjaxMessageBtnClick() {
  117.     switch (scMsgDefClick) {
  118.       case "close":
  119.         document.getElementById("id_message_display_frame").style.display = "none";
  120.         break;
  121.       case "close_modal":
  122.         tb_remove();
  123.         break;
  124.       case "redir1":
  125.         document.form_ajax_redir_1.submit();
  126.         break;
  127.       case "redir2":
  128.         document.form_ajax_redir_2.submit();
  129.         document.getElementById("id_message_display_frame").style.display = "none";
  130.         break;
  131.       case "redir2_modal":
  132.         document.form_ajax_redir_2.submit();
  133.         tb_remove();
  134.         break;
  135.     }
  136.   }
  137.   function _nmAjaxMessageBtnClose() {
  138.     switch (scMsgDefClose) {
  139.       case "close":
  140.         document.getElementById("id_message_display_frame").style.display = "none";
  141.         break;
  142.       case "close_modal":
  143.         tb_remove();
  144.         break;
  145.     }
  146.   }
  147. function _nmAjaxShowMessage(params) {
  148.     _nmAjaxShowMessage_toast(params);
  149. } // _nmAjaxShowMessage
  150. function _nmAjaxShowMessage_toast(params) {
  151.     var sTitle = params["title"], sMessage = params["message"], bModal = params["isModal"], iTimeout = params["timeout"], bButton = params["showButton"], sButton = params["buttonLabel"], iTop = params["topPos"], iLeft = params["leftPos"], iWidth = params["width"], iHeight = params["height"], sRedir = params["redirUrl"], sTarget = params["redirTarget"], sParam = params["redirParam"], bClose = params["showClose"], bBodyIcon = params["showBodyIcon"];
  152.     var sweetAlertParams = {};

  153.     if ("" != params["type"]) {
  154.         sweetAlertParams["type"] = params["type"];
  155.     }

  156.     if ("" != params["title"]) {
  157.         sweetAlertParams["title"] = params["title"];
  158.     }

  159.     if (params["isToast"]) {
  160.         sweetAlertParams["toast"] = true;
  161.         sweetAlertParams["showConfirmButton"] = false;
  162.         sweetAlertParams["showCancelButton"] = false;

  163.         if ("" != params["toastPos"]) {
  164.             sweetAlertParams["position"] = params["toastPos"];
  165.         }

  166.         if (null == sweetAlertParams["position"]) {
  167.             sweetAlertParams["position"] = "top-end";
  168.         }

  169.         if (null == sweetAlertParams["timer"]) {
  170.             sweetAlertParams["timer"] = 3000;
  171.         }
  172.     }

  173.     scJs_alert_sweetalert(sMessage, function() {}, scJs_sweetalert_params(sweetAlertParams));
  174. } // _nmAjaxShowMessage_toast
  175. function scJs_alert_default(message) {
  176.     alert(message);
  177. } // scJs_alert_default

  178. function scJs_confirm_default(message, callbackOk, callbackCancel) {
  179.     if (confirm(message)) {
  180.         callbackOk();
  181.     }
  182.     else {
  183.         callbackCancel();
  184.     }
  185. } // scJs_confirm_default

  186. function scJs_alert(message, params) {
  187.     scJs_alert_sweetalert(message, function() {}, scJs_sweetalert_params(params));
  188. } // scJs_alert

  189. function scJs_confirm(message, callbackOk, callbackCancel) {
  190.     scJs_confirm_sweetalert(message, callbackOk, callbackCancel);
  191. } // scJs_confirm

  192. function scJs_alert_sweetalert(message, callbackOk, params) {
  193.     var sweetAlertConfig;

  194.     if (null == params) {
  195.         params = {};
  196.     }

  197.     params['html'] = message;

  198.     sweetAlertConfig = params;

  199.     Swal.fire(sweetAlertConfig).then(function (result) {
  200.         if (result.value) {
  201.             if (typeof callbackOk == "function") {
  202.                 callbackOk();
  203.             }
  204.         }
  205.         else if (result.dismiss == Swal.DismissReason.timer) {
  206.             Swal.close();
  207.         }
  208.     });
  209. } // scJs_alert_sweetalert

  210. function scJs_sweetalert_params(params) {
  211.     var parName, confirmText, confirmFA, confirmPos, cancelText, cancelFA, cancelPos, sweetAlertConfig;

  212.     sweetAlertConfig = {
  213.         customClass: {
  214.             popup: 'scSweetAlertPopup',
  215.             header: 'scSweetAlertHeader',
  216.             content: 'scSweetAlertMessage',
  217.             confirmButton: scSweetAlertConfirmButton,
  218.             cancelButton: scSweetAlertCancelButton
  219.         }
  220.     };

  221.     confirmText = scSweetAlertConfirmButtonText;
  222.     confirmFA = scSweetAlertConfirmButtonFA;
  223.     confirmPos = scSweetAlertConfirmButtonFAPos;
  224.     cancelText = scSweetAlertCancelButtonText;
  225.     cancelFA = scSweetAlertCancelButtonFA;
  226.     cancelPos = scSweetAlertCancelButtonFAPos;

  227.     for (parName in params) {
  228.         if ('confirmButtonText' == parName) {
  229.             confirmText = params[parName];
  230.         }
  231.         else if ('confirmButtonFA' == parName) {
  232.             confirmFA = params[parName];
  233.         }
  234.         else if ('confirmButtonFAPos' == parName) {
  235.             confirmPos = params[parName];
  236.         }
  237.         else if ('cancelButtonText' == parName) {
  238.             cancelText = params[parName];
  239.         }
  240.         else if ('cancelButtonFA' == parName) {
  241.             cancelFA = params[parName];
  242.         }
  243.         else if ('cancelButtonFAPos' == parName) {
  244.             cancelPos = params[parName];
  245.         }
  246.         else {
  247.             sweetAlertConfig[parName] = params[parName];
  248.         }
  249.     }

  250.     if ('' != confirmFA) {
  251.         if ('text_right' == confirmPos) {
  252.             confirmText = '<i class="fas ' + confirmFA + '"></i> ' + confirmText;
  253.         }
  254.         else {
  255.             confirmText += ' <i class="fas ' + confirmFA + '"></i>';
  256.         }
  257.     }
  258.     if ('' != cancelFA) {
  259.         if ('text_right' == cancelPos) {
  260.             cancelText = '<i class="fas ' + cancelFA + '"></i> ' + cancelText;
  261.         }
  262.         else {
  263.             cancelText += ' <i class="fas ' + cancelFA + '"></i>';
  264.         }
  265.     }

  266.     sweetAlertConfig['confirmButtonText'] = confirmText;
  267.     sweetAlertConfig['cancelButtonText'] = cancelText;

  268.     if (sweetAlertConfig['toast']) {
  269.         sweetAlertConfig['showConfirmButton'] = false;
  270.         sweetAlertConfig['showCancelButton'] = false;
  271.         sweetAlertConfig['customClass']['popup'] = 'scToastPopup';
  272.         sweetAlertConfig['customClass']['header'] = 'scToastHeader';
  273.         sweetAlertConfig['customClass']['content'] = 'scToastMessage';
  274.         if (null == sweetAlertConfig['timer']) {
  275.             sweetAlertConfig['timer'] = 3000;
  276.         }
  277.         if (null == sweetAlertConfig["position"]) {
  278.             sweetAlertConfig["position"] = "top-end";
  279.         }
  280.     }

  281.     return sweetAlertConfig;
  282. } // scJs_sweetalert_params

  283. function scJs_confirm_sweetalert(message, callbackOk, callbackCancel) {
  284.     Swal.fire({
  285.         text: message,
  286.         type: 'warning',
  287.         showCancelButton: true,
  288.         customClass: {
  289.             popup: 'scSweetAlertPopup',
  290.             header: 'scSweetAlertHeader',
  291.             content: 'scSweetAlertMessage',
  292.             confirmButton: scSweetAlertConfirmButton,
  293.             cancelButton: scSweetAlertCancelButton
  294.         }
  295.     }).then(function (result) {
  296.         if (result.value) {
  297.             callbackOk();
  298.         }
  299.         else if (result.dismiss === Swal.DismissReason.backdrop || result.dismiss === Swal.DismissReason.cancel || result.dismiss === Swal.DismissReason.esc) {
  300.             callbackCancel();
  301.         }
  302.     });
  303. } // scJs_confirm_sweetalert
Return
grid_new_mobile_pesq.class.php
  1. <?php

  2. class grid_new_pesq
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;
  8.    var $cmp_formatado;
  9.    var $nm_data;
  10.    var $Campos_Mens_erro;

  11.    var $comando;
  12.    var $comando_sum;
  13.    var $comando_filtro;
  14.    var $comando_ini;
  15.    var $comando_fim;
  16.    var $NM_operador;
  17.    var $NM_data_qp;
  18.    var $NM_path_filter;
  19.    var $NM_curr_fil;
  20.    var $nm_location;
  21.    var $NM_ajax_opcao;
  22.    var $nmgp_botoes = array();
  23.    var $NM_fil_ant = array();

  24.    /**
  25.     * @access  public
  26.     */
  27.    function __construct()
  28.    {
  29.    }

  30.    /**
  31.     * @access  public
  32.     * @global  string  $bprocessa  
  33.     */
  34.    function monta_busca()
  35.    {
  36.       global $bprocessa;
  37.       include("../_lib/css/" $this->Ini->str_schema_filter "_filter.php");
  38.       $this->Ini->Str_btn_filter trim($str_button) . "/" trim($str_button) . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".php";
  39.       $this->Str_btn_filter_css  trim($str_button) . "/" trim($str_button) . ".css";
  40.       $this->Ini->str_google_fonts = (isset($str_google_fonts) && !empty($str_google_fonts))?$str_google_fonts:'';
  41.       include($this->Ini->path_btn $this->Ini->Str_btn_filter);
  42.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['path_libs_php'] = $this->Ini->path_lib_php;
  43.       $this->Img_sep_filter "/" trim($str_toolbar_separator);
  44.       $this->Block_img_col  trim($str_block_col);
  45.       $this->Block_img_exp  trim($str_block_exp);
  46.       $this->Bubble_tail    trim($str_bubble_tail);
  47.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_gp_config_btn.php""F""nmButtonOutput"); 
  48.       $this->init();
  49.       if ($this->NM_ajax_flag && $this->NM_ajax_opcao == "ajax_grid_search_change_fil")
  50.       {
  51.           $arr_new_fil $this->recupera_filtro($this->NM_ajax_grid_fil);
  52.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = array(); 
  53.           foreach ($arr_new_fil as $tp)
  54.           {
  55.               foreach ($tp as $ind => $cada_dado)
  56.               {
  57.                   $field $cada_dado['field'];
  58.                   if (substr($cada_dado['field'], 03) == "SC_")
  59.                   {
  60.                       $field substr($cada_dado['field'], 3);
  61.                   }
  62.                   if (substr($cada_dado['field'], 06) == "id_ac_")
  63.                   {
  64.                       $field substr($cada_dado['field'], 6);
  65.                   }
  66.                   if (is_array($cada_dado['value']))
  67.                   {
  68.                       $arr_tmp = array();
  69.                       foreach($cada_dado['value'] as $ix => $dados)
  70.                       {
  71.                           if (isset($dados['opt']))
  72.                           {
  73.                               $arr_tmp[] = $dados['opt'];
  74.                           }
  75.                           else
  76.                           {
  77.                               $arr_tmp[] = $dados;
  78.                           }
  79.                       }
  80.                       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$field] = $arr_tmp
  81.                   }
  82.                   else
  83.                   {
  84.                       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$field] = $cada_dado['value']; 
  85.                   }
  86.               }
  87.           }
  88.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  89.           {
  90.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = NM_conv_charset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'], $_SESSION['scriptcase']['charset'], "UTF-8");
  91.           }
  92.           $this->processa_busca();
  93.           if (!empty($this->Campos_Mens_erro)) 
  94.           {
  95.               scriptcase_error_display($this->Campos_Mens_erro""); 
  96.               return false;
  97.           }
  98.           return true;
  99.       }
  100.       if ($this->NM_ajax_flag && $this->NM_ajax_opcao == "ajax_grid_search")
  101.       {
  102.          $this->processa_busca();
  103.          return;
  104.       }
  105.       if ($this->NM_ajax_flag)
  106.       {
  107.           ob_start();
  108.           $this->Arr_result = array();
  109.           $this->processa_ajax();
  110.           $Temp ob_get_clean();
  111.           if ($Temp !== false && trim($Temp) != "")
  112.           {
  113.               $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  114.           }
  115.           $oJson = new Services_JSON();
  116.           echo $oJson->encode($this->Arr_result);
  117.           if ($this->Db)
  118.           {
  119.               $this->Db->Close(); 
  120.           }
  121.           exit;
  122.       }
  123.       if (isset($bprocessa) && "pesq" == $bprocessa)
  124.       {
  125.          $this->processa_busca();
  126.       }
  127.       else
  128.       {
  129.          $this->monta_formulario();
  130.       }
  131.    }

  132.    /**
  133.     * @access  public
  134.     */
  135.    function monta_formulario()
  136.    {
  137.       $this->monta_html_ini();
  138.       $this->monta_cabecalho();
  139.       $this->monta_form();
  140.       $this->monta_html_fim();
  141.    }

  142.    /**
  143.     * @access  public
  144.     */
  145.    function init()
  146.    {
  147.       global $bprocessa;
  148.       $_SESSION['scriptcase']['sc_tab_meses']['int'] = array(
  149.                                   $this->Ini->Nm_lang['lang_mnth_janu'],
  150.                                   $this->Ini->Nm_lang['lang_mnth_febr'],
  151.                                   $this->Ini->Nm_lang['lang_mnth_marc'],
  152.                                   $this->Ini->Nm_lang['lang_mnth_apri'],
  153.                                   $this->Ini->Nm_lang['lang_mnth_mayy'],
  154.                                   $this->Ini->Nm_lang['lang_mnth_june'],
  155.                                   $this->Ini->Nm_lang['lang_mnth_july'],
  156.                                   $this->Ini->Nm_lang['lang_mnth_augu'],
  157.                                   $this->Ini->Nm_lang['lang_mnth_sept'],
  158.                                   $this->Ini->Nm_lang['lang_mnth_octo'],
  159.                                   $this->Ini->Nm_lang['lang_mnth_nove'],
  160.                                   $this->Ini->Nm_lang['lang_mnth_dece']);
  161.       $_SESSION['scriptcase']['sc_tab_meses']['abr'] = array(
  162.                                   $this->Ini->Nm_lang['lang_shrt_mnth_janu'],
  163.                                   $this->Ini->Nm_lang['lang_shrt_mnth_febr'],
  164.                                   $this->Ini->Nm_lang['lang_shrt_mnth_marc'],
  165.                                   $this->Ini->Nm_lang['lang_shrt_mnth_apri'],
  166.                                   $this->Ini->Nm_lang['lang_shrt_mnth_mayy'],
  167.                                   $this->Ini->Nm_lang['lang_shrt_mnth_june'],
  168.                                   $this->Ini->Nm_lang['lang_shrt_mnth_july'],
  169.                                   $this->Ini->Nm_lang['lang_shrt_mnth_augu'],
  170.                                   $this->Ini->Nm_lang['lang_shrt_mnth_sept'],
  171.                                   $this->Ini->Nm_lang['lang_shrt_mnth_octo'],
  172.                                   $this->Ini->Nm_lang['lang_shrt_mnth_nove'],
  173.                                   $this->Ini->Nm_lang['lang_shrt_mnth_dece']);
  174.       $_SESSION['scriptcase']['sc_tab_dias']['int'] = array(
  175.                                   $this->Ini->Nm_lang['lang_days_sund'],
  176.                                   $this->Ini->Nm_lang['lang_days_mond'],
  177.                                   $this->Ini->Nm_lang['lang_days_tued'],
  178.                                   $this->Ini->Nm_lang['lang_days_wend'],
  179.                                   $this->Ini->Nm_lang['lang_days_thud'],
  180.                                   $this->Ini->Nm_lang['lang_days_frid'],
  181.                                   $this->Ini->Nm_lang['lang_days_satd']);
  182.       $_SESSION['scriptcase']['sc_tab_dias']['abr'] = array(
  183.                                   $this->Ini->Nm_lang['lang_shrt_days_sund'],
  184.                                   $this->Ini->Nm_lang['lang_shrt_days_mond'],
  185.                                   $this->Ini->Nm_lang['lang_shrt_days_tued'],
  186.                                   $this->Ini->Nm_lang['lang_shrt_days_wend'],
  187.                                   $this->Ini->Nm_lang['lang_shrt_days_thud'],
  188.                                   $this->Ini->Nm_lang['lang_shrt_days_frid'],
  189.                                   $this->Ini->Nm_lang['lang_shrt_days_satd']);
  190.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_functions.php""""") ; 
  191.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_api.php""""") ; 
  192.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_data.class.php""C""nm_data") ; 
  193.       $this->nm_data = new nm_data("en_us");
  194.       $pos_path strrpos($this->Ini->path_prod"/");
  195.       $this->NM_path_filter $this->Ini->root substr($this->Ini->path_prod0$pos_path) . "/conf/filters/";
  196.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "igual";
  197.    }

  198.    function processa_ajax()
  199.    {
  200.       global $NM_filters$NM_filters_del$nmgp_save_name$nmgp_save_option$NM_fields_refresh$NM_parms_refresh$Campo_bi$Opc_bi$NM_operador$nmgp_save_origem;
  201. //-- ajax metodos ---
  202.       if ($this->NM_ajax_opcao == "ajax_filter_save")
  203.       {
  204.           ob_end_clean();
  205.           ob_end_clean();
  206.           $this->salva_filtro($nmgp_save_origem);
  207.           $this->NM_fil_ant $this->gera_array_filtros();
  208.           $Nome_filter "";
  209.           $Opt_filter  "<option value=\"\"></option>\r\n";
  210.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  211.           {
  212.               if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  213.               {
  214.                   $Tipo_filter[1] = sc_convert_encoding($Tipo_filter[1], "UTF-8"$_SESSION['scriptcase']['charset']);
  215.               }
  216.               if ($Tipo_filter[1] != $Nome_filter)
  217.               {
  218.                   $Nome_filter $Tipo_filter[1];
  219.                   $Opt_filter .= "<option value=\"\">" grid_new_pack_protect_string($Nome_filter) . "</option>\r\n";
  220.               }
  221.               $Opt_filter .= "<option value=\"" grid_new_pack_protect_string($Tipo_filter[0]) . "\">.." grid_new_pack_protect_string($Cada_filter) .  "</option>\r\n";
  222.           }
  223.           if (isset($nmgp_save_origem) && $nmgp_save_origem == "grid")
  224.           {
  225.               $Ajax_select  "<SELECT id=\"id_sel_recup_filters\" class=\"scFilterToolbar_obj\" name=\"sel_recup_filters\" onChange=\"nm_change_grid_search(this)\" size=\"1\">\r\n";
  226.               $Ajax_select .= $Opt_filter;
  227.               $Ajax_select .= "</SELECT>\r\n";
  228.               $this->Arr_result['setValue'][] = array('field' => "id_NM_filters_save"'value' => $Ajax_select);
  229.               $Ajax_select "<SELECT id=\"sel_filters_del\" class=\"scFilterToolbar_obj\" name=\"NM_filters_del\" size=\"1\">\r\n";
  230.               $Ajax_select .= $Opt_filter;
  231.               $Ajax_select .= "</SELECT>\r\n";
  232.               $this->Arr_result['setValue'][] = array('field' => "id_sel_filters_del"'value' => $Ajax_select);
  233.               return;
  234.           }
  235.           $Ajax_select  "<SELECT id=\"sel_recup_filters_bot\" name=\"NM_filters_bot\" onChange=\"nm_submit_filter(this, 'bot');\" size=\"1\">\r\n";
  236.           $Ajax_select .= $Opt_filter;
  237.           $Ajax_select .= "</SELECT>\r\n";
  238.           $this->Arr_result['setValue'][] = array('field' => "idAjaxSelect_NM_filters_bot"'value' => $Ajax_select);
  239.           $Ajax_select "<SELECT id=\"sel_filters_del_bot\" class=\"scFilterToolbar_obj\" name=\"NM_filters_del_bot\" size=\"1\">\r\n";
  240.           $Ajax_select .= $Opt_filter;
  241.           $Ajax_select .= "</SELECT>\r\n";
  242.           $this->Arr_result['setValue'][] = array('field' => "idAjaxSelect_NM_filters_del_bot"'value' => $Ajax_select);
  243.       }

  244.       if ($this->NM_ajax_opcao == "ajax_filter_delete")
  245.       {
  246.           ob_end_clean();
  247.           ob_end_clean();
  248.           $this->apaga_filtro();
  249.           $this->NM_fil_ant $this->gera_array_filtros();
  250.           $Nome_filter "";
  251.           $Opt_filter  "<option value=\"\"></option>\r\n";
  252.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  253.           {
  254.               if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  255.               {
  256.                   $Tipo_filter[1] = sc_convert_encoding($Tipo_filter[1], "UTF-8"$_SESSION['scriptcase']['charset']);
  257.               }
  258.               if ($Tipo_filter[1] != $Nome_filter)
  259.               {
  260.                   $Nome_filter  $Tipo_filter[1];
  261.                   $Opt_filter .= "<option value=\"\">" .  grid_new_pack_protect_string($Nome_filter) . "</option>\r\n";
  262.               }
  263.               $Opt_filter .= "<option value=\"" grid_new_pack_protect_string($Tipo_filter[0]) . "\">.." grid_new_pack_protect_string($Cada_filter) .  "</option>\r\n";
  264.           }
  265.           if (isset($nmgp_save_origem) && $nmgp_save_origem == "grid")
  266.           {
  267.               $Ajax_select  "<SELECT id=\"id_sel_recup_filters\" class=\"scFilterToolbar_obj\" name=\"sel_recup_filters\" onChange=\"nm_change_grid_search(this)\" size=\"1\">\r\n";
  268.               $Ajax_select .= $Opt_filter;
  269.               $Ajax_select .= "</SELECT>\r\n";
  270.               $this->Arr_result['setValue'][] = array('field' => "id_NM_filters_save"'value' => $Ajax_select);
  271.               $Ajax_select "<SELECT id=\"sel_filters_del\" class=\"scFilterToolbar_obj\" name=\"NM_filters_del\" size=\"1\">\r\n";
  272.               $Ajax_select .= $Opt_filter;
  273.               $Ajax_select .= "</SELECT>\r\n";
  274.               $this->Arr_result['setValue'][] = array('field' => "id_sel_filters_del"'value' => $Ajax_select);
  275.               return;
  276.           }
  277.           $Ajax_select  "<SELECT id=\"sel_recup_filters_bot\" class=\"scFilterToolbar_obj\" style=\"display:". (count($this->NM_fil_ant)>0?'':'none') .";\" name=\"NM_filters_bot\" onChange=\"nm_submit_filter(this, 'bot');\" size=\"1\">\r\n";
  278.           $Ajax_select .= $Opt_filter;
  279.           $Ajax_select .= "</SELECT>\r\n";
  280.           $this->Arr_result['setValue'][] = array('field' => "idAjaxSelect_NM_filters_bot"'value' => $Ajax_select);
  281.           $Ajax_select "<SELECT id=\"sel_filters_del_bot\" class=\"scFilterToolbar_obj\" name=\"NM_filters_del_bot\" size=\"1\">\r\n";
  282.           $Ajax_select .= $Opt_filter;
  283.           $Ajax_select .= "</SELECT>\r\n";
  284.           $this->Arr_result['setValue'][] = array('field' => "idAjaxSelect_NM_filters_del_bot"'value' => $Ajax_select);
  285.       }
  286.       if ($this->NM_ajax_opcao == "ajax_filter_select")
  287.       {
  288.           ob_end_clean();
  289.           ob_end_clean();
  290.           $this->Arr_result $this->recupera_filtro($NM_filters);
  291.       }

  292.       if ($this->NM_ajax_opcao == 'autocomp_proprietarios_nome')
  293.       {
  294.           $proprietarios_nome = ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($_GET['q'])) ? sc_convert_encoding($_GET['q'], $_SESSION['scriptcase']['charset'], "UTF-8") : $_GET['q'];
  295.           $nmgp_def_dados $this->lookup_ajax_proprietarios_nome($proprietarios_nome);
  296.           ob_end_clean();
  297.           ob_end_clean();
  298.           $count_aut_comp 0;
  299.           $resp_aut_comp  = array();
  300.           foreach ($nmgp_def_dados as $Ind => $Lista)
  301.           {
  302.              if (is_array($Lista))
  303.              {
  304.                  foreach ($Lista as $Cod => $Valor)
  305.                  {
  306.                      if ($_GET['cod_desc'] == "S")
  307.                      {
  308.                          $Valor $Cod " - " $Valor;
  309.                      }
  310.                      $resp_aut_comp[] = array('label' => $Valor 'value' => $Cod);
  311.                      $count_aut_comp++;
  312.                  }
  313.              }
  314.              if ($count_aut_comp == $_GET['max_itens'])
  315.              {
  316.                  break;
  317.              }
  318.           }
  319.           $oJson = new Services_JSON();
  320.           echo $oJson->encode($resp_aut_comp);
  321.           $this->Db->Close(); 
  322.           exit;
  323.       }
  324.       if ($this->NM_ajax_opcao == 'autocomp_proprietarios_sexo')
  325.       {
  326.           $proprietarios_sexo = ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($_GET['q'])) ? sc_convert_encoding($_GET['q'], $_SESSION['scriptcase']['charset'], "UTF-8") : $_GET['q'];
  327.           $nmgp_def_dados $this->lookup_ajax_proprietarios_sexo($proprietarios_sexo);
  328.           ob_end_clean();
  329.           ob_end_clean();
  330.           $count_aut_comp 0;
  331.           $resp_aut_comp  = array();
  332.           foreach ($nmgp_def_dados as $Ind => $Lista)
  333.           {
  334.              if (is_array($Lista))
  335.              {
  336.                  foreach ($Lista as $Cod => $Valor)
  337.                  {
  338.                      if ($_GET['cod_desc'] == "S")
  339.                      {
  340.                          $Valor $Cod " - " $Valor;
  341.                      }
  342.                      $resp_aut_comp[] = array('label' => $Valor 'value' => $Cod);
  343.                      $count_aut_comp++;
  344.                  }
  345.              }
  346.              if ($count_aut_comp == $_GET['max_itens'])
  347.              {
  348.                  break;
  349.              }
  350.           }
  351.           $oJson = new Services_JSON();
  352.           echo $oJson->encode($resp_aut_comp);
  353.           $this->Db->Close(); 
  354.           exit;
  355.       }
  356.    }
  357.    function lookup_ajax_proprietarios_nome($proprietarios_nome)
  358.    {
  359.       $proprietarios_nome substr($this->Db->qstr($proprietarios_nome), 1, -1);
  360.             $proprietarios_nome_look substr($this->Db->qstr($proprietarios_nome), 1, -1); 
  361.       $nmgp_def_dados = array(); 
  362.       $nm_comando "select distinct Proprietarios.Nome from " $this->Ini->nm_tabela " where  Proprietarios.Nome like '%" $proprietarios_nome "%' order by Proprietarios.Nome"
  363.       unset($cmp1,$cmp2);
  364.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  365.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  366.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  367.       { 
  368.          while (!$rs->EOF
  369.          { 
  370.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  371.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  372.             $rs->MoveNext() ; 
  373.          } 
  374.          $rs->Close() ; 
  375.       } 
  376.       else  
  377.       {  
  378.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  379.          exit; 
  380.       } 

  381.       return $nmgp_def_dados;
  382.    }
  383.    
  384.    function lookup_ajax_proprietarios_sexo($proprietarios_sexo)
  385.    {
  386.       $proprietarios_sexo substr($this->Db->qstr($proprietarios_sexo), 1, -1);
  387.             $proprietarios_sexo_look substr($this->Db->qstr($proprietarios_sexo), 1, -1); 
  388.       $nmgp_def_dados = array(); 
  389.       $nm_comando "select distinct Proprietarios.Sexo from " $this->Ini->nm_tabela " where  Proprietarios.Sexo like '%" $proprietarios_sexo "%' order by Proprietarios.Sexo"
  390.       unset($cmp1,$cmp2);
  391.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  392.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  393.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  394.       { 
  395.          while (!$rs->EOF
  396.          { 
  397.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  398.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  399.             $rs->MoveNext() ; 
  400.          } 
  401.          $rs->Close() ; 
  402.       } 
  403.       else  
  404.       {  
  405.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  406.          exit; 
  407.       } 

  408.       return $nmgp_def_dados;
  409.    }
  410.    

  411.    /**
  412.     * @access  public
  413.     */
  414.    function processa_busca()
  415.    {
  416.       $this->inicializa_vars();
  417.       $this->trata_campos();
  418.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  419.       {
  420.           $this->finaliza_resultado_ajax();
  421.           return;
  422.       }
  423.       if (!empty($this->Campos_Mens_erro)) 
  424.       {
  425.           $this->monta_formulario();
  426.       }
  427.       else
  428.       {
  429.           $this->finaliza_resultado();
  430.       }
  431.    }

  432.    /**
  433.     * @access  public
  434.     */
  435.    function and_or()
  436.    {
  437.       $posWhere strpos(strtolower($this->comando), "where");
  438.       if (FALSE === $posWhere)
  439.       {
  440.          $this->comando     .= " where (";
  441.          $this->comando_sum .= " and (";
  442.          $this->comando_fim  " ) ";
  443.       }
  444.       if ($this->comando_ini == "ini")
  445.       {
  446.           if (FALSE !== $posWhere)
  447.           {
  448.               $this->comando     .= " and ( ";
  449.               $this->comando_sum .= " and ( ";
  450.               $this->comando_fim  " ) ";
  451.           }
  452.          $this->comando_ini  "";
  453.       }
  454.       elseif ("or" == $this->NM_operador)
  455.       {
  456.          $this->comando        .= " or ";
  457.          $this->comando_sum    .= " or ";
  458.          $this->comando_filtro .= " or ";
  459.       }
  460.       else
  461.       {
  462.          $this->comando        .= " and ";
  463.          $this->comando_sum    .= " and ";
  464.          $this->comando_filtro .= " and ";
  465.       }
  466.    }

  467.    /**
  468.     * @access  public
  469.     * @param  string  $nome  
  470.     * @param  string  $condicao  
  471.     * @param  mixed  $campo  
  472.     * @param  mixed  $campo2  
  473.     * @param  string  $nome_campo  
  474.     * @param  string  $tp_campo  
  475.     * @global  array  $nmgp_tab_label  
  476.     */
  477.    function monta_condicao($nome$condicao$campo$campo2 ""$nome_campo=""$tp_campo="")
  478.    {
  479.       global $nmgp_tab_label;
  480.       $condicao   strtoupper($condicao);
  481.       $nm_aspas   "'";
  482.       $nm_aspas1  "'";
  483.       $Nm_numeric = array();
  484.       $nm_esp_postgres = array();
  485.       $nm_ini_lower "";
  486.       $nm_fim_lower "";
  487.       $Nm_numeric[] = "proprietarios_idproprietario";$Nm_numeric[] = "proprietarios_cpf";$Nm_numeric[] = "veiculos_idveiculos";$Nm_numeric[] = "veiculos_idproprietario_fk";$Nm_numeric[] = "proprietarios_idproprietario";$Nm_numeric[] = "proprietarios_cpf";$Nm_numeric[] = "veiculos_idveiculos";$Nm_numeric[] = "veiculos_idproprietario_fk";
  488.       $campo_join strtolower(str_replace(".""_"$nome));
  489.       if (in_array($campo_join$Nm_numeric))
  490.       {
  491.           if ($condicao == "EP" || $condicao == "NE")
  492.           {
  493.               unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$campo_join]);
  494.               return;
  495.           }
  496.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['decimal_db'] == ".")
  497.          {
  498.             $nm_aspas  "";
  499.             $nm_aspas1 "";
  500.          }
  501.          if ($condicao != "IN")
  502.          {
  503.             if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['decimal_db'] == ".")
  504.             {
  505.                $campo  str_replace(",""."$campo);
  506.                $campo2 str_replace(",""."$campo2);
  507.             }
  508.             if ($campo == "")
  509.             {
  510.                $campo 0;
  511.             }
  512.             if ($campo2 == "")
  513.             {
  514.                $campo2 0;
  515.             }
  516.          }
  517.       }
  518.       if ($campo == "" && $condicao != "NU" && $condicao != "NN" && $condicao != "EP" && $condicao != "NE")
  519.       {
  520.          return;
  521.       }
  522.       else
  523.       {
  524.          $tmp_pos strpos($campo"##@@");
  525.          if ($tmp_pos === false)
  526.          {
  527.              $res_lookup $campo;
  528.          }
  529.          else
  530.          {
  531.              $res_lookup substr($campo$tmp_pos 4);
  532.              $campo substr($campo0$tmp_pos);
  533.              if ($campo == "" && $condicao != "NU" && $condicao != "NN" && $condicao != "EP" && $condicao != "NE")
  534.              {
  535.                  return;
  536.              }
  537.          }
  538.          $tmp_pos strpos($this->cmp_formatado[$nome_campo], "##@@");
  539.          if ($tmp_pos !== false)
  540.          {
  541.              $this->cmp_formatado[$nome_campo] = substr($this->cmp_formatado[$nome_campo], $tmp_pos 4);
  542.          }
  543.          $this->and_or();
  544.          $campo  substr($this->Db->qstr($campo), 1, -1);
  545.          $campo2 substr($this->Db->qstr($campo2), 1, -1);
  546.          $nome_sum "$nome";
  547.          if ($tp_campo == "TIMESTAMP")
  548.          {
  549.              $tp_campo "DATETIME";
  550.          }
  551.          if (in_array($campo_join$Nm_numeric) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && ($condicao == "II" || $condicao == "QP" || $condicao == "NP"))
  552.          {
  553.              $nome     "CAST ($nome AS TEXT)";
  554.              $nome_sum "CAST ($nome_sum AS TEXT)";
  555.          }
  556.          if (in_array($campo_join$nm_esp_postgres) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  557.          {
  558.              $nome     "CAST ($nome AS TEXT)";
  559.              $nome_sum "CAST ($nome_sum AS TEXT)";
  560.          }
  561.          if (substr($tp_campo08) == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && !$this->Date_part)
  562.          {
  563.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  564.                  $nome     "to_char ($nome, 'YYYY-MM-DD hh24:mi:ss')";
  565.                  $nome_sum "to_char ($nome_sum, 'YYYY-MM-DD hh24:mi:ss')";
  566.              }
  567.          }
  568.          elseif (substr($tp_campo04) == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && !$this->Date_part)
  569.          {
  570.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  571.                  $nome     "to_char ($nome, 'YYYY-MM-DD')";
  572.                  $nome_sum "to_char ($nome_sum, 'YYYY-MM-DD')";
  573.              }
  574.          }
  575.          elseif (substr($tp_campo04) == "TIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && !$this->Date_part)
  576.          {
  577.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  578.                  $nome     "to_char ($nome, 'hh24:mi:ss')";
  579.                  $nome_sum "to_char ($nome_sum, 'hh24:mi:ss')";
  580.              }
  581.          }
  582.          if ($tp_campo == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql) && !$this->Date_part)
  583.          {
  584.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  585.                  $nome     "convert(char(10),$nome,121)";
  586.                  $nome_sum "convert(char(10),$nome_sum,121)";
  587.              }
  588.          }
  589.          if ($tp_campo == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql) && !$this->Date_part)
  590.          {
  591.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  592.                  $nome     "convert(char(19),$nome,121)";
  593.                  $nome_sum "convert(char(19),$nome_sum,121)";
  594.              }
  595.          }
  596.          if (substr($tp_campo08) == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle) && !$this->Date_part)
  597.          {
  598.              $nome     "TO_DATE(TO_CHAR($nome, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss')";
  599.              $nome_sum "TO_DATE(TO_CHAR($nome_sum, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss')";
  600.              $tp_campo "DATETIME";
  601.          }
  602.          if (substr($tp_campo08) == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix) && !$this->Date_part)
  603.          {
  604.              $nome     "EXTEND($nome, YEAR TO FRACTION)";
  605.              $nome_sum "EXTEND($nome_sum, YEAR TO FRACTION)";
  606.          }
  607.          elseif (substr($tp_campo04) == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix) && !$this->Date_part)
  608.          {
  609.              $nome     "EXTEND($nome, YEAR TO DAY)";
  610.              $nome_sum "EXTEND($nome_sum, YEAR TO DAY)";
  611.          }
  612.          if (in_array($campo_join$Nm_numeric) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress) && ($condicao == "II" || $condicao == "QP" || $condicao == "NP"))
  613.          {
  614.              $nome     "CAST ($nome AS VARCHAR(255))";
  615.              $nome_sum "CAST ($nome_sum AS VARCHAR(255))";
  616.          }
  617.          if (substr($tp_campo08) == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress) && !$this->Date_part)
  618.          {
  619.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  620.                  $nome     "to_char ($nome, 'YYYY-MM-DD hh24:mi:ss')";
  621.                  $nome_sum "to_char ($nome_sum, 'YYYY-MM-DD hh24:mi:ss')";
  622.              }
  623.          }
  624.          if (substr($tp_campo04) == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress) && !$this->Date_part)
  625.          {
  626.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  627.                  $nome     "to_char ($nome, 'YYYY-MM-DD')";
  628.                  $nome_sum "to_char ($nome_sum, 'YYYY-MM-DD')";
  629.              }
  630.          }
  631.          switch ($condicao)
  632.          {
  633.             case "EQ":     // 
  634.                $this->comando        .= $nm_ini_lower $nome $nm_fim_lower " = " $nm_aspas $campo $nm_aspas1;
  635.                $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower " = " $nm_aspas $campo $nm_aspas1;
  636.                $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower" = " $nm_aspas $campo $nm_aspas1;
  637.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_equl'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  638.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  639.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_equl'] . " " $this->cmp_formatado[$nome_campo];
  640.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_equl'] . " " $this->cmp_formatado[$nome_campo];
  641.             break;
  642.             case "II":     // 
  643.                $this->comando        .= $nm_ini_lower $nome $nm_fim_lower " like '" $campo "%'";
  644.                $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower " like '" $campo "%'";
  645.                $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower " like '" $campo "%'";
  646.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_strt'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  647.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  648.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_strt'] . " " $this->cmp_formatado[$nome_campo];
  649.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_strt'] . " " $this->cmp_formatado[$nome_campo];
  650.             break;
  651.              case "QP";     // 
  652.              case "NP";     // 
  653.                 $concat " " $this->NM_operador " ";
  654.                 if ($condicao == "QP")
  655.                 {
  656.                     $op_all    " like ";
  657.                     $lang_like $this->Ini->Nm_lang['lang_srch_like'];
  658.                 }
  659.                 else
  660.                 {
  661.                     $op_all    " not like ";
  662.                     $lang_like $this->Ini->Nm_lang['lang_srch_not_like'];
  663.                 }
  664.                $NM_cond    "";
  665.                $NM_cmd     "";
  666.                $NM_cmd_sum "";
  667.                if (substr($tp_campo04) == "DATE" && $this->Date_part)
  668.                {
  669.                    if ($this->NM_data_qp['ano'] != "____")
  670.                    {
  671.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  672.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_year'] . " " $this->Lang_date_part " " $this->NM_data_qp['ano'];
  673.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  674.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  675.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  676.                        {
  677.                            $NM_cmd     .= "strftime('%Y', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  678.                            $NM_cmd_sum .= "strftime('%Y', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  679.                        }
  680.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  681.                        {
  682.                            $NM_cmd     .= "extract(year from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  683.                            $NM_cmd_sum .= "extract(year from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  684.                        }
  685.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  686.                        {
  687.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  688.                            {
  689.                                $NM_cmd     .= "to_char (" $nome ", 'YYYY') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  690.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'YYYY') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  691.                            }
  692.                            else
  693.                            {
  694.                                $NM_cmd     .= $this->Ini_date_char "extract('year' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  695.                                $NM_cmd_sum .= $this->Ini_date_char "extract('year' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  696.                            }
  697.                        }
  698.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  699.                        {
  700.                            $NM_cmd     .= "extract(year from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  701.                            $NM_cmd_sum .= "extract(year from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  702.                        }
  703.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  704.                        {
  705.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'YYYY')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  706.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'YYYY')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  707.                        }
  708.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  709.                        {
  710.                            $NM_cmd     .= "DATEPART(year, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  711.                            $NM_cmd_sum .= "DATEPART(year, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  712.                        }
  713.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  714.                        {
  715.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  716.                            {
  717.                                $NM_cmd     .= "to_char (" $nome ", 'YYYY') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  718.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'YYYY') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  719.                            }
  720.                            else
  721.                            {
  722.                                $NM_cmd     .= "year (" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  723.                                $NM_cmd_sum .= "year (" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  724.                            }
  725.                        }
  726.                        else
  727.                        {
  728.                            $NM_cmd     .= "year(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  729.                            $NM_cmd_sum .= "year(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  730.                        }
  731.                    }
  732.                    if ($this->NM_data_qp['mes'] != "__")
  733.                    {
  734.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  735.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_mnth'] . " " $this->Lang_date_part " " $this->NM_data_qp['mes'];
  736.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  737.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  738.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  739.                        {
  740.                            $NM_cmd     .= "strftime('%m', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  741.                            $NM_cmd_sum .= "strftime('%m', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  742.                        }
  743.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  744.                        {
  745.                            $NM_cmd     .= "extract(month from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  746.                            $NM_cmd_sum .= "extract(month from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  747.                        }
  748.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  749.                        {
  750.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  751.                            {
  752.                                $NM_cmd     .= "to_char (" $nome ", 'MM') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  753.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'MM') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  754.                            }
  755.                            else
  756.                            {
  757.                                $NM_cmd     .= $this->Ini_date_char "extract('month' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  758.                                $NM_cmd_sum .= $this->Ini_date_char "extract('month' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  759.                            }
  760.                        }
  761.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  762.                        {
  763.                            $NM_cmd     .= "extract(month from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  764.                            $NM_cmd_sum .= "extract(month from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  765.                        }
  766.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  767.                        {
  768.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'MM')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  769.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'MM')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  770.                        }
  771.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  772.                        {
  773.                            $NM_cmd     .= "DATEPART(month, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  774.                            $NM_cmd_sum .= "DATEPART(month, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  775.                        }
  776.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  777.                        {
  778.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  779.                            {
  780.                                $NM_cmd     .= "to_char (" $nome ", 'MM') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  781.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'MM') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  782.                            }
  783.                            else
  784.                            {
  785.                                $NM_cmd     .= "month (" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  786.                                $NM_cmd_sum .= "month (" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  787.                            }
  788.                        }
  789.                        else
  790.                        {
  791.                            $NM_cmd     .= "month(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  792.                            $NM_cmd_sum .= "month(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  793.                        }
  794.                    }
  795.                    if ($this->NM_data_qp['dia'] != "__")
  796.                    {
  797.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  798.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_days'] . " " $this->Lang_date_part " " $this->NM_data_qp['dia'];
  799.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  800.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  801.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  802.                        {
  803.                            $NM_cmd     .= "strftime('%d', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  804.                            $NM_cmd_sum .= "strftime('%d', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  805.                        }
  806.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  807.                        {
  808.                            $NM_cmd     .= "extract(day from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  809.                            $NM_cmd_sum .= "extract(day from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  810.                        }
  811.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  812.                        {
  813.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  814.                            {
  815.                                $NM_cmd     .= "to_char (" $nome ", 'DD') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  816.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'DD') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  817.                            }
  818.                            else
  819.                            {
  820.                                $NM_cmd     .= $this->Ini_date_char "extract('day' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  821.                                $NM_cmd_sum .= $this->Ini_date_char "extract('day' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  822.                            }
  823.                        }
  824.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  825.                        {
  826.                            $NM_cmd     .= "extract(day from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  827.                            $NM_cmd_sum .= "extract(day from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  828.                        }
  829.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  830.                        {
  831.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'DD')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  832.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'DD')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  833.                        }
  834.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  835.                        {
  836.                            $NM_cmd     .= "DATEPART(day, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  837.                            $NM_cmd_sum .= "DATEPART(day, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  838.                        }
  839.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  840.                        {
  841.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  842.                            {
  843.                                $NM_cmd     .= "to_char (" $nome ", 'DD') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  844.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'DD') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  845.                            }
  846.                            else
  847.                            {
  848.                                $NM_cmd     .= "DAYOFMONTH(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  849.                                $NM_cmd_sum .= "DAYOFMONTH(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  850.                            }
  851.                        }
  852.                        else
  853.                        {
  854.                            $NM_cmd     .= "day(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  855.                            $NM_cmd_sum .= "day(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  856.                        }
  857.                    }
  858.                }
  859.                if (strpos($tp_campo"TIME") !== false && $this->Date_part)
  860.                {
  861.                    if ($this->NM_data_qp['hor'] != "__")
  862.                    {
  863.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  864.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_time'] . " " $this->Lang_date_part " " $this->NM_data_qp['hor'];
  865.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  866.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  867.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  868.                        {
  869.                            $NM_cmd     .= "strftime('%H', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  870.                            $NM_cmd_sum .= "strftime('%H', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  871.                        }
  872.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  873.                        {
  874.                            $NM_cmd     .= "extract(hour from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  875.                            $NM_cmd_sum .= "extract(hour from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  876.                        }
  877.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  878.                        {
  879.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  880.                            {
  881.                                $NM_cmd     .= "to_char (" $nome ", 'hh24') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  882.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'hh24') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  883.                            }
  884.                            else
  885.                            {
  886.                                $NM_cmd     .= $this->Ini_date_char "extract('hour' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  887.                                $NM_cmd_sum .= $this->Ini_date_char "extract('hour' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  888.                            }
  889.                        }
  890.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  891.                        {
  892.                            $NM_cmd     .= "extract(hour from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  893.                            $NM_cmd_sum .= "extract(hour from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  894.                        }
  895.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  896.                        {
  897.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'HH24')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  898.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'HH24')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  899.                        }
  900.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  901.                        {
  902.                            $NM_cmd     .= "DATEPART(hour, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  903.                            $NM_cmd_sum .= "DATEPART(hour, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  904.                        }
  905.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  906.                        {
  907.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  908.                            {
  909.                                $NM_cmd     .= "to_char (" $nome ", 'hh24') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  910.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'hh24') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  911.                            }
  912.                            else
  913.                            {
  914.                                $NM_cmd     .= "hour(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  915.                                $NM_cmd_sum .= "hour(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  916.                            }
  917.                        }
  918.                        else
  919.                        {
  920.                            $NM_cmd     .= "hour(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  921.                            $NM_cmd_sum .= "hour(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  922.                        }
  923.                    }
  924.                    if ($this->NM_data_qp['min'] != "__")
  925.                    {
  926.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  927.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_mint'] . " " $this->Lang_date_part " " $this->NM_data_qp['min'];
  928.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  929.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  930.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  931.                        {
  932.                            $NM_cmd     .= "strftime('%M', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  933.                            $NM_cmd_sum .= "strftime('%M', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  934.                        }
  935.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  936.                        {
  937.                            $NM_cmd     .= "extract(minute from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  938.                            $NM_cmd_sum .= "extract(minute from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  939.                        }
  940.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  941.                        {
  942.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  943.                            {
  944.                                $NM_cmd     .= "to_char (" $nome ", 'mi') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  945.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'mi') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  946.                            }
  947.                            else
  948.                            {
  949.                                $NM_cmd     .= $this->Ini_date_char "extract('minute' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  950.                                $NM_cmd_sum .= $this->Ini_date_char "extract('minute' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  951.                            }
  952.                        }
  953.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  954.                        {
  955.                            $NM_cmd     .= "extract(minute from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  956.                            $NM_cmd_sum .= "extract(minute from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  957.                        }
  958.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  959.                        {
  960.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'MI')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  961.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'MI')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  962.                        }
  963.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  964.                        {
  965.                            $NM_cmd     .= "DATEPART(minute, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  966.                            $NM_cmd_sum .= "DATEPART(minute, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  967.                        }
  968.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  969.                        {
  970.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  971.                            {
  972.                                $NM_cmd     .= "to_char (" $nome ", 'mi') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  973.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'mi') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  974.                            }
  975.                            else
  976.                            {
  977.                                $NM_cmd     .= "minute(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  978.                                $NM_cmd_sum .= "minute(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  979.                            }
  980.                        }
  981.                        else
  982.                        {
  983.                            $NM_cmd     .= "minute(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  984.                            $NM_cmd_sum .= "minute(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  985.                        }
  986.                    }
  987.                    if ($this->NM_data_qp['seg'] != "__")
  988.                    {
  989.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  990.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_scnd'] . " " $this->Lang_date_part " " $this->NM_data_qp['seg'];
  991.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  992.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  993.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  994.                        {
  995.                            $NM_cmd     .= "strftime('%S', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  996.                            $NM_cmd_sum .= "strftime('%S', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  997.                        }
  998.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  999.                        {
  1000.                            $NM_cmd     .= "extract(second from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1001.                            $NM_cmd_sum .= "extract(second from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1002.                        }
  1003.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  1004.                        {
  1005.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  1006.                            {
  1007.                                $NM_cmd     .= "to_char (" $nome ", 'ss') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1008.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'ss') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1009.                            }
  1010.                            else
  1011.                            {
  1012.                                $NM_cmd     .= $this->Ini_date_char "extract('second' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1013.                                $NM_cmd_sum .= $this->Ini_date_char "extract('second' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1014.                            }
  1015.                        }
  1016.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  1017.                        {
  1018.                            $NM_cmd     .= "extract(second from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1019.                            $NM_cmd_sum .= "extract(second from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1020.                        }
  1021.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  1022.                        {
  1023.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'SS')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1024.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'SS')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1025.                        }
  1026.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  1027.                        {
  1028.                            $NM_cmd     .= "DATEPART(second, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1029.                            $NM_cmd_sum .= "DATEPART(second, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1030.                        }
  1031.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  1032.                        {
  1033.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  1034.                            {
  1035.                                $NM_cmd     .= "to_char (" $nome ", 'ss') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1036.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'ss') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1037.                            }
  1038.                            else
  1039.                            {
  1040.                                $NM_cmd     .= "second(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1041.                                $NM_cmd_sum .= "second(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1042.                            }
  1043.                        }
  1044.                        else
  1045.                        {
  1046.                            $NM_cmd     .= "second(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1047.                            $NM_cmd_sum .= "second(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1048.                        }
  1049.                    }
  1050.                }
  1051.                if ($this->Date_part)
  1052.                {
  1053.                    if (!empty($NM_cmd))
  1054.                    {
  1055.                        $NM_cmd     " (" $NM_cmd ")";
  1056.                        $NM_cmd_sum " (" $NM_cmd_sum ")";
  1057.                        $this->comando        .= $NM_cmd;
  1058.                        $this->comando_sum    .= $NM_cmd_sum;
  1059.                        $this->comando_filtro .= $NM_cmd;
  1060.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . ": " $NM_cond "##*@@";
  1061.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1062.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $NM_cond;
  1063.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $NM_cond;
  1064.                    }
  1065.                }
  1066.                else
  1067.                {
  1068.                    $this->comando        .= $nm_ini_lower $nome $nm_fim_lower $op_all "'%" $campo "%'";
  1069.                    $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower $op_all "'%" $campo "%'";
  1070.                    $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower $op_all "'%" $campo "%'";
  1071.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $lang_like " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1072.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1073.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $lang_like " " $this->cmp_formatado[$nome_campo];
  1074.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $lang_like " " $this->cmp_formatado[$nome_campo];
  1075.                }
  1076.             break;
  1077.             case "DF":     // 
  1078.                $this->comando        .= $nm_ini_lower $nome $nm_fim_lower " <> " $nm_aspas $campo $nm_aspas1;
  1079.                $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower " <> " $nm_aspas $campo $nm_aspas1;
  1080.                $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower " <> " $nm_aspas $campo $nm_aspas1;
  1081.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_diff'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1082.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1083.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_diff'] . " " $this->cmp_formatado[$nome_campo];
  1084.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_diff'] . " " $this->cmp_formatado[$nome_campo];
  1085.             break;
  1086.             case "GT":     // 
  1087.                $this->comando        .= $nome > " $nm_aspas $campo $nm_aspas1;
  1088.                $this->comando_sum    .= $nome_sum > " $nm_aspas $campo $nm_aspas1;
  1089.                $this->comando_filtro .= $nome > " $nm_aspas $campo $nm_aspas1;
  1090.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_grtr'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1091.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1092.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_grtr'] . " " $this->cmp_formatado[$nome_campo];
  1093.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_grtr'] . " " $this->cmp_formatado[$nome_campo];
  1094.             break;
  1095.             case "GE":     // 
  1096.                $this->comando        .= $nome >= " $nm_aspas $campo $nm_aspas1;
  1097.                $this->comando_sum    .= $nome_sum >= " $nm_aspas $campo $nm_aspas1;
  1098.                $this->comando_filtro .= $nome >= " $nm_aspas $campo $nm_aspas1;
  1099.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_grtr_equl'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1100.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1101.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_grtr_equl'] . " " $this->cmp_formatado[$nome_campo];
  1102.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_grtr_equl'] . " " $this->cmp_formatado[$nome_campo];
  1103.             break;
  1104.             case "LT":     // 
  1105.                $this->comando        .= $nome < " $nm_aspas $campo $nm_aspas1;
  1106.                $this->comando_sum    .= $nome_sum < " $nm_aspas $campo $nm_aspas1;
  1107.                $this->comando_filtro .= $nome < " $nm_aspas $campo $nm_aspas1;
  1108.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_less'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1109.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1110.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_less'] . " " $this->cmp_formatado[$nome_campo];
  1111.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_less'] . " " $this->cmp_formatado[$nome_campo];
  1112.             break;
  1113.             case "LE":     // 
  1114.                $this->comando        .= $nome <= " $nm_aspas $campo $nm_aspas1;
  1115.                $this->comando_sum    .= $nome_sum <= " $nm_aspas $campo $nm_aspas1;
  1116.                $this->comando_filtro .= $nome <= " $nm_aspas $campo $nm_aspas1;
  1117.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_less_equl'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1118.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1119.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_less_equl'] . " " $this->cmp_formatado[$nome_campo];
  1120.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_less_equl'] . " " $this->cmp_formatado[$nome_campo];
  1121.             break;
  1122.             case "BW":     // 
  1123.                $this->comando        .= $nome between " $nm_aspas $campo $nm_aspas1 " and " $nm_aspas $campo2 $nm_aspas1;
  1124.                $this->comando_sum    .= $nome_sum between " $nm_aspas $campo $nm_aspas1 " and " $nm_aspas $campo2 $nm_aspas1;
  1125.                $this->comando_filtro .= $nome between " $nm_aspas $campo $nm_aspas1 " and " $nm_aspas $campo2 $nm_aspas1;
  1126.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_betw'] . " " $this->cmp_formatado[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " " $this->cmp_formatado[$nome_campo "_input_2"] . "##*@@";
  1127.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1128.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_betw'] . " " $this->cmp_formatado[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " " $this->cmp_formatado[$nome_campo "_input_2"];
  1129.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_betw'] . " " $this->cmp_formatado[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " " $this->cmp_formatado[$nome_campo "_input_2"];
  1130.             break;
  1131.             case "IN":     // 
  1132.                $nm_sc_valores explode(","$campo);
  1133.                $cond_str  "";
  1134.                $nm_cond   "";
  1135.                $cond_descr  "";
  1136.                $count_descr 0;
  1137.                $end_descr   false;
  1138.                $lim_descr   15;
  1139.                $lang_descr  strlen($this->Ini->Nm_lang['lang_srch_orr_cond']);
  1140.                if (!empty($nm_sc_valores))
  1141.                {
  1142.                    foreach ($nm_sc_valores as $nm_sc_valor)
  1143.                    {
  1144.                       if (in_array($campo_join$Nm_numeric) && substr_count($nm_sc_valor".") > 1)
  1145.                       {
  1146.                          $nm_sc_valor str_replace("."""$nm_sc_valor);
  1147.                       }
  1148.                       if ("" != $cond_str)
  1149.                       {
  1150.                          $cond_str .= ",";
  1151.                          $nm_cond  .= " " $this->Ini->Nm_lang['lang_srch_orr_cond'] . " ";
  1152.                       }
  1153.                       $cond_str .= $nm_aspas $nm_sc_valor $nm_aspas1;
  1154.                       $nm_cond  .= $nm_aspas $nm_sc_valor $nm_aspas1;
  1155.                       if (((strlen($cond_descr) + strlen($nm_sc_valor) + $lang_descr) < $lim_descr) || empty($cond_descr))
  1156.                       {
  1157.                           $cond_descr .= (empty($cond_descr)) ? "" " " $this->Ini->Nm_lang['lang_srch_orr_cond'] . " ";
  1158.                           $cond_descr .= $nm_aspas $nm_sc_valor $nm_aspas1;
  1159.                           $count_descr++;
  1160.                       }
  1161.                       elseif (!$end_descr)
  1162.                       {
  1163.                           $cond_descr .= " +" . (count($nm_sc_valores) - $count_descr);
  1164.                           $end_descr true;
  1165.                       };
  1166.                    }
  1167.                }
  1168.                $this->comando        .= $nm_ini_lower $nome $nm_fim_lower " in (" $cond_str ")";
  1169.                $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower " in (" $cond_str ")";
  1170.                $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower " in (" $cond_str ")";
  1171.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_like'] . " " $nm_cond "##*@@";
  1172.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1173.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_like'] . " " $cond_descr;
  1174.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_like'] . " " $nm_cond;
  1175.             break;
  1176.             case "NU":     // 
  1177.                $this->comando        .= $nome IS NULL ";
  1178.                $this->comando_sum    .= $nome_sum IS NULL ";
  1179.                $this->comando_filtro .= $nome IS NULL ";
  1180.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_null'] . "##*@@";
  1181.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1182.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_null'];
  1183.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_null'];
  1184.             break;
  1185.             case "NN":     // 
  1186.                $this->comando        .= $nome IS NOT NULL ";
  1187.                $this->comando_sum    .= $nome_sum IS NOT NULL ";
  1188.                $this->comando_filtro .= $nome IS NOT NULL ";
  1189.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_nnul'] . "##*@@";
  1190.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1191.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_nnul'];
  1192.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_nnul'];
  1193.             break;
  1194.             case "EP":     // 
  1195.                $this->comando        .= $nome = '' ";
  1196.                $this->comando_sum    .= $nome_sum = '' ";
  1197.                $this->comando_filtro .= $nome = '' ";
  1198.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_empty'] . "##*@@";
  1199.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1200.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_empty'];
  1201.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_empty'];
  1202.             break;
  1203.             case "NE":     // 
  1204.                $this->comando        .= $nome <> '' ";
  1205.                $this->comando_sum    .= $nome_sum <> '' ";
  1206.                $this->comando_filtro .= $nome <> '' ";
  1207.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_nempty'] . "##*@@";
  1208.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1209.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_nempty'];
  1210.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_nempty'];
  1211.             break;
  1212.          }
  1213.       }
  1214.    }

  1215.    function nm_prep_date(&$val$tp$tsql, &$cond$format_nd$tp_nd)
  1216.    {
  1217.        $fill_dt false;
  1218.        if ($tsql == "TIMESTAMP")
  1219.        {
  1220.            $tsql "DATETIME";
  1221.        }
  1222.        $cond strtoupper($cond);
  1223.        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access) && $tp != "ND")
  1224.        {
  1225.            if ($cond == "EP")
  1226.            {
  1227.                $cond "NU";
  1228.            }
  1229.            if ($cond == "NE")
  1230.            {
  1231.                $cond "NN";
  1232.            }
  1233.        }
  1234.        if ($cond == "NU" || $cond == "NN" || $cond == "EP" || $cond == "NE")
  1235.        {
  1236.            $val    = array();
  1237.            $val[0] = "";
  1238.            return;
  1239.        }
  1240.        if ($cond != "II" && $cond != "QP" && $cond != "NP")
  1241.        {
  1242.            $fill_dt true;
  1243.        }
  1244.        if ($fill_dt)
  1245.        {
  1246.            $val[0]['dia'] = (!empty($val[0]['dia']) && strlen($val[0]['dia']) == 1) ? "0" $val[0]['dia'] : $val[0]['dia'];
  1247.            $val[0]['mes'] = (!empty($val[0]['mes']) && strlen($val[0]['mes']) == 1) ? "0" $val[0]['mes'] : $val[0]['mes'];
  1248.            if ($tp == "DH")
  1249.            {
  1250.                $val[0]['hor'] = (!empty($val[0]['hor']) && strlen($val[0]['hor']) == 1) ? "0" $val[0]['hor'] : $val[0]['hor'];
  1251.                $val[0]['min'] = (!empty($val[0]['min']) && strlen($val[0]['min']) == 1) ? "0" $val[0]['min'] : $val[0]['min'];
  1252.                $val[0]['seg'] = (!empty($val[0]['seg']) && strlen($val[0]['seg']) == 1) ? "0" $val[0]['seg'] : $val[0]['seg'];
  1253.            }
  1254.            if ($cond == "BW")
  1255.            {
  1256.                $val[1]['dia'] = (!empty($val[1]['dia']) && strlen($val[1]['dia']) == 1) ? "0" $val[1]['dia'] : $val[1]['dia'];
  1257.                $val[1]['mes'] = (!empty($val[1]['mes']) && strlen($val[1]['mes']) == 1) ? "0" $val[1]['mes'] : $val[1]['mes'];
  1258.                if ($tp == "DH")
  1259.                {
  1260.                    $val[1]['hor'] = (!empty($val[1]['hor']) && strlen($val[1]['hor']) == 1) ? "0" $val[1]['hor'] : $val[1]['hor'];
  1261.                    $val[1]['min'] = (!empty($val[1]['min']) && strlen($val[1]['min']) == 1) ? "0" $val[1]['min'] : $val[1]['min'];
  1262.                    $val[1]['seg'] = (!empty($val[1]['seg']) && strlen($val[1]['seg']) == 1) ? "0" $val[1]['seg'] : $val[1]['seg'];
  1263.                }
  1264.            }
  1265.        }
  1266.        if ($cond == "BW")
  1267.        {
  1268.            $this->NM_data_1 = array();
  1269.            $this->NM_data_1['ano'] = (isset($val[0]['ano']) && !empty($val[0]['ano'])) ? $val[0]['ano'] : "____";
  1270.            $this->NM_data_1['mes'] = (isset($val[0]['mes']) && !empty($val[0]['mes'])) ? $val[0]['mes'] : "__";
  1271.            $this->NM_data_1['dia'] = (isset($val[0]['dia']) && !empty($val[0]['dia'])) ? $val[0]['dia'] : "__";
  1272.            $this->NM_data_1['hor'] = (isset($val[0]['hor']) && !empty($val[0]['hor'])) ? $val[0]['hor'] : "__";
  1273.            $this->NM_data_1['min'] = (isset($val[0]['min']) && !empty($val[0]['min'])) ? $val[0]['min'] : "__";
  1274.            $this->NM_data_1['seg'] = (isset($val[0]['seg']) && !empty($val[0]['seg'])) ? $val[0]['seg'] : "__";
  1275.            $this->data_menor($this->NM_data_1);
  1276.            $this->NM_data_2 = array();
  1277.            $this->NM_data_2['ano'] = (isset($val[1]['ano']) && !empty($val[1]['ano'])) ? $val[1]['ano'] : "____";
  1278.            $this->NM_data_2['mes'] = (isset($val[1]['mes']) && !empty($val[1]['mes'])) ? $val[1]['mes'] : "__";
  1279.            $this->NM_data_2['dia'] = (isset($val[1]['dia']) && !empty($val[1]['dia'])) ? $val[1]['dia'] : "__";
  1280.            $this->NM_data_2['hor'] = (isset($val[1]['hor']) && !empty($val[1]['hor'])) ? $val[1]['hor'] : "__";
  1281.            $this->NM_data_2['min'] = (isset($val[1]['min']) && !empty($val[1]['min'])) ? $val[1]['min'] : "__";
  1282.            $this->NM_data_2['seg'] = (isset($val[1]['seg']) && !empty($val[1]['seg'])) ? $val[1]['seg'] : "__";
  1283.            $this->data_maior($this->NM_data_2);
  1284.            $val = array();
  1285.            if ($tp == "ND")
  1286.            {
  1287.                $out_dt1 $format_nd;
  1288.                $out_dt1 str_replace("yyyy"$this->NM_data_1['ano'], $out_dt1);
  1289.                $out_dt1 str_replace("mm",   $this->NM_data_1['mes'], $out_dt1);
  1290.                $out_dt1 str_replace("dd",   $this->NM_data_1['dia'], $out_dt1);
  1291.                $out_dt1 str_replace("hh",   ""$out_dt1);
  1292.                $out_dt1 str_replace("ii",   ""$out_dt1);
  1293.                $out_dt1 str_replace("ss",   ""$out_dt1);
  1294.                $out_dt2 $format_nd;
  1295.                $out_dt2 str_replace("yyyy"$this->NM_data_2['ano'], $out_dt2);
  1296.                $out_dt2 str_replace("mm",   $this->NM_data_2['mes'], $out_dt2);
  1297.                $out_dt2 str_replace("dd",   $this->NM_data_2['dia'], $out_dt2);
  1298.                $out_dt2 str_replace("hh",   ""$out_dt2);
  1299.                $out_dt2 str_replace("ii",   ""$out_dt2);
  1300.                $out_dt2 str_replace("ss",   ""$out_dt2);
  1301.                $val[0] = $out_dt1;
  1302.                $val[1] = $out_dt2;
  1303.                return;
  1304.            }
  1305.            if ($tsql == "TIME")
  1306.            {
  1307.                $val[0] = $this->NM_data_1['hor'] . ":" $this->NM_data_1['min'] . ":" $this->NM_data_1['seg'];
  1308.                $val[1] = $this->NM_data_2['hor'] . ":" $this->NM_data_2['min'] . ":" $this->NM_data_2['seg'];
  1309.            }
  1310.            elseif (substr($tsql04) == "DATE")
  1311.            {
  1312.                $val[0] = $this->NM_data_1['ano'] . "-" $this->NM_data_1['mes'] . "-" $this->NM_data_1['dia'];
  1313.                $val[1] = $this->NM_data_2['ano'] . "-" $this->NM_data_2['mes'] . "-" $this->NM_data_2['dia'];
  1314.                if (strpos($tsql"TIME") !== false)
  1315.                {
  1316.                    $val[0] .= " " $this->NM_data_1['hor'] . ":" $this->NM_data_1['min'] . ":" $this->NM_data_1['seg'];
  1317.                    $val[1] .= " " $this->NM_data_2['hor'] . ":" $this->NM_data_2['min'] . ":" $this->NM_data_2['seg'];
  1318.                }
  1319.            }
  1320.            return;
  1321.        }
  1322.        $this->NM_data_qp = array();
  1323.        $this->NM_data_qp['ano'] = (isset($val[0]['ano']) && $val[0]['ano'] != "") ? $val[0]['ano'] : "____";
  1324.        $this->NM_data_qp['mes'] = (isset($val[0]['mes']) && $val[0]['mes'] != "") ? $val[0]['mes'] : "__";
  1325.        $this->NM_data_qp['dia'] = (isset($val[0]['dia']) && $val[0]['dia'] != "") ? $val[0]['dia'] : "__";
  1326.        $this->NM_data_qp['hor'] = (isset($val[0]['hor']) && $val[0]['hor'] != "") ? $val[0]['hor'] : "__";
  1327.        $this->NM_data_qp['min'] = (isset($val[0]['min']) && $val[0]['min'] != "") ? $val[0]['min'] : "__";
  1328.        $this->NM_data_qp['seg'] = (isset($val[0]['seg']) && $val[0]['seg'] != "") ? $val[0]['seg'] : "__";
  1329.        if ($tp != "ND" && ($cond == "LE" || $cond == "LT" || $cond == "GE" || $cond == "GT"))
  1330.        {
  1331.            $count_fill 0;
  1332.            foreach ($this->NM_data_qp as $x => $tx)
  1333.            {
  1334.                if (substr($tx02) != "__")
  1335.                {
  1336.                    $count_fill++;
  1337.                }
  1338.            }
  1339.            if ($count_fill 1)
  1340.            {
  1341.                if ($cond == "LE" || $cond == "GT")
  1342.                {
  1343.                    $this->data_maior($this->NM_data_qp);
  1344.                }
  1345.                else
  1346.                {
  1347.                    $this->data_menor($this->NM_data_qp);
  1348.                }
  1349.                if ($tsql == "TIME")
  1350.                {
  1351.                    $val[0] = $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1352.                }
  1353.                elseif (substr($tsql04) == "DATE")
  1354.                {
  1355.                    $val[0] = $this->NM_data_qp['ano'] . "-" $this->NM_data_qp['mes'] . "-" $this->NM_data_qp['dia'];
  1356.                    if (strpos($tsql"TIME") !== false)
  1357.                    {
  1358.                        $val[0] .= " " $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1359.                    }
  1360.                }
  1361.                return;
  1362.            }
  1363.        }
  1364.        foreach ($this->NM_data_qp as $x => $tx)
  1365.        {
  1366.            if (substr($tx02) == "__" && ($x == "dia" || $x == "mes" || $x == "ano"))
  1367.            {
  1368.                if (substr($tsql04) == "DATE")
  1369.                {
  1370.                    $this->Date_part true;
  1371.                    break;
  1372.                }
  1373.            }
  1374.            if (substr($tx02) == "__" && ($x == "hor" || $x == "min" || $x == "seg"))
  1375.            {
  1376.                if (strpos($tsql"TIME") !== false && ($tp == "DH" || ($tp == "DT" && $cond != "LE" && $cond != "LT" && $cond != "GE" && $cond != "GT")))
  1377.                {
  1378.                    $this->Date_part true;
  1379.                    break;
  1380.                }
  1381.            }
  1382.        }
  1383.        if ($this->Date_part)
  1384.        {
  1385.            $this->Ini_date_part "";
  1386.            $this->End_date_part "";
  1387.            $this->Ini_date_char "";
  1388.            $this->End_date_char "";
  1389.            if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  1390.            {
  1391.                $this->Ini_date_part "'";
  1392.                $this->End_date_part "'";
  1393.            }
  1394.            if ($tp != "ND")
  1395.            {
  1396.                if ($cond == "EQ")
  1397.                {
  1398.                    $this->Operador_date_part " = ";
  1399.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_equl'];
  1400.                }
  1401.                elseif ($cond == "II")
  1402.                {
  1403.                    $this->Operador_date_part " like ";
  1404.                    $this->Ini_date_part "'";
  1405.                    $this->End_date_part "%'";
  1406.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_strt'];
  1407.                    if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  1408.                    {
  1409.                        $this->Ini_date_char "CAST (";
  1410.                        $this->End_date_char " AS TEXT)";
  1411.                    }
  1412.                }
  1413.                elseif ($cond == "DF")
  1414.                {
  1415.                    $this->Operador_date_part " <> ";
  1416.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_diff'];
  1417.                }
  1418.                elseif ($cond == "GT")
  1419.                {
  1420.                    $this->Operador_date_part " > ";
  1421.                    $this->Lang_date_part $this->Ini->Nm_lang['pesq_cond_maior'];
  1422.                }
  1423.                elseif ($cond == "GE")
  1424.                {
  1425.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_grtr_equl'];
  1426.                    $this->Operador_date_part " >= ";
  1427.                }
  1428.                elseif ($cond == "LT")
  1429.                {
  1430.                    $this->Operador_date_part " < ";
  1431.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_less'];
  1432.                }
  1433.                elseif ($cond == "LE")
  1434.                {
  1435.                    $this->Operador_date_part " <= ";
  1436.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_less_equl'];
  1437.                }
  1438.                elseif ($cond == "NP")
  1439.                {
  1440.                    $this->Operador_date_part " not like ";
  1441.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_diff'];
  1442.                    $this->Ini_date_part "'%";
  1443.                    $this->End_date_part "%'";
  1444.                    if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  1445.                    {
  1446.                        $this->Ini_date_char "CAST (";
  1447.                        $this->End_date_char " AS TEXT)";
  1448.                    }
  1449.                }
  1450.                else
  1451.                {
  1452.                    $this->Operador_date_part " like ";
  1453.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_equl'];
  1454.                    $this->Ini_date_part "'%";
  1455.                    $this->End_date_part "%'";
  1456.                    if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  1457.                    {
  1458.                        $this->Ini_date_char "CAST (";
  1459.                        $this->End_date_char " AS TEXT)";
  1460.                    }
  1461.                }
  1462.            }
  1463.            if ($cond == "DF")
  1464.            {
  1465.                $cond "NP";
  1466.            }
  1467.            if ($cond != "NP")
  1468.            {
  1469.                $cond "QP";
  1470.            }
  1471.        }
  1472.        $val = array();
  1473.        if ($tp != "ND" && ($cond == "QP" || $cond == "NP"))
  1474.        {
  1475.            $val[0] = "";
  1476.            if (substr($tsql04) == "DATE")
  1477.            {
  1478.                $val[0] .= $this->NM_data_qp['ano'] . "-" $this->NM_data_qp['mes'] . "-" $this->NM_data_qp['dia'];
  1479.                if (strpos($tsql"TIME") !== false)
  1480.                {
  1481.                    $val[0] .= " ";
  1482.                }
  1483.            }
  1484.            if (strpos($tsql"TIME") !== false)
  1485.            {
  1486.                $val[0] .= $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1487.            }
  1488.            return;
  1489.        }
  1490.        if ($cond == "II" || $cond == "DF" || $cond == "EQ" || $cond == "LT" || $cond == "GE")
  1491.        {
  1492.            $this->data_menor($this->NM_data_qp);
  1493.        }
  1494.        else
  1495.        {
  1496.            $this->data_maior($this->NM_data_qp);
  1497.        }
  1498.        if ($tsql == "TIME")
  1499.        {
  1500.            $val[0] = $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1501.            return;
  1502.        }
  1503.        $format_sql "";
  1504.        if (substr($tsql04) == "DATE")
  1505.        {
  1506.            $format_sql .= $this->NM_data_qp['ano'] . "-" $this->NM_data_qp['mes'] . "-" $this->NM_data_qp['dia'];
  1507.            if (strpos($tsql"TIME") !== false)
  1508.            {
  1509.                $format_sql .= " ";
  1510.            }
  1511.        }
  1512.        if (strpos($tsql"TIME") !== false)
  1513.        {
  1514.            $format_sql .=  $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1515.        }
  1516.        if ($tp != "ND")
  1517.        {
  1518.            $val[0] = $format_sql;
  1519.            return;
  1520.        }
  1521.        if ($tp == "ND")
  1522.        {
  1523.            $format_nd str_replace("yyyy"$this->NM_data_qp['ano'], $format_nd);
  1524.            $format_nd str_replace("mm",   $this->NM_data_qp['mes'], $format_nd);
  1525.            $format_nd str_replace("dd",   $this->NM_data_qp['dia'], $format_nd);
  1526.            $format_nd str_replace("hh",   $this->NM_data_qp['hor'], $format_nd);
  1527.            $format_nd str_replace("ii",   $this->NM_data_qp['min'], $format_nd);
  1528.            $format_nd str_replace("ss",   $this->NM_data_qp['seg'], $format_nd);
  1529.            $val[0] = $format_nd;
  1530.            return;
  1531.        }
  1532.    }
  1533.    function data_menor(&$data_arr)
  1534.    {
  1535.        $data_arr["ano"] = ("____" == $data_arr["ano"]) ? "0001" $data_arr["ano"];
  1536.        $data_arr["mes"] = ("__" == $data_arr["mes"])   ? "01" $data_arr["mes"];
  1537.        $data_arr["dia"] = ("__" == $data_arr["dia"])   ? "01" $data_arr["dia"];
  1538.        $data_arr["hor"] = ("__" == $data_arr["hor"])   ? "00" $data_arr["hor"];
  1539.        $data_arr["min"] = ("__" == $data_arr["min"])   ? "00" $data_arr["min"];
  1540.        $data_arr["seg"] = ("__" == $data_arr["seg"])   ? "00" $data_arr["seg"];
  1541.    }

  1542.    function data_maior(&$data_arr)
  1543.    {
  1544.        $data_arr["ano"] = ("____" == $data_arr["ano"]) ? "9999" $data_arr["ano"];
  1545.        $data_arr["mes"] = ("__" == $data_arr["mes"])   ? "12" $data_arr["mes"];
  1546.        $data_arr["hor"] = ("__" == $data_arr["hor"])   ? "23" $data_arr["hor"];
  1547.        $data_arr["min"] = ("__" == $data_arr["min"])   ? "59" $data_arr["min"];
  1548.        $data_arr["seg"] = ("__" == $data_arr["seg"])   ? "59" $data_arr["seg"];
  1549.        if ("__" == $data_arr["dia"])
  1550.        {
  1551.            $data_arr["dia"] = "31";
  1552.            if ($data_arr["mes"] == "04" || $data_arr["mes"] == "06" || $data_arr["mes"] == "09" || $data_arr["mes"] == "11")
  1553.            {
  1554.                $data_arr["dia"] = 30;
  1555.            }
  1556.            elseif ($data_arr["mes"] == "02")
  1557.            { 
  1558.                 if  ($data_arr["ano"] % == 0)
  1559.                 {
  1560.                      $data_arr["dia"] = 29;
  1561.                 }
  1562.                 else 
  1563.                 {
  1564.                      $data_arr["dia"] = 28;
  1565.                 }
  1566.            }
  1567.        }
  1568.    }

  1569.    /**
  1570.     * @access  public
  1571.     * @param  string  $nm_data_hora  
  1572.     */
  1573.    function limpa_dt_hor_pesq(&$nm_data_hora)
  1574.    {
  1575.       $nm_data_hora str_replace("Y"""$nm_data_hora); 
  1576.       $nm_data_hora str_replace("M"""$nm_data_hora); 
  1577.       $nm_data_hora str_replace("D"""$nm_data_hora); 
  1578.       $nm_data_hora str_replace("H"""$nm_data_hora); 
  1579.       $nm_data_hora str_replace("I"""$nm_data_hora); 
  1580.       $nm_data_hora str_replace("S"""$nm_data_hora); 
  1581.       $tmp_pos strpos($nm_data_hora"--");
  1582.       if ($tmp_pos !== FALSE)
  1583.       {
  1584.           $nm_data_hora str_replace("--""-"$nm_data_hora); 
  1585.       }
  1586.       $tmp_pos strpos($nm_data_hora"::");
  1587.       if ($tmp_pos !== FALSE)
  1588.       {
  1589.           $nm_data_hora str_replace("::"":"$nm_data_hora); 
  1590.       }
  1591.    }

  1592.    /**
  1593.     * @access  public
  1594.     */
  1595.    function retorna_pesq()
  1596.    {
  1597.       global $nm_apl_dependente;
  1598.    $NM_retorno "./";
  1599. ?>
  1600. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  1601.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  1602. <HTML>
  1603. <HEAD>
  1604.  <TITLE> </TITLE>
  1605.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  1606. <?php
  1607. if ($_SESSION['scriptcase']['proc_mobile'])
  1608. {
  1609. ?>
  1610.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  1611. <?php
  1612. }
  1613. ?>
  1614.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  1615.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  1616.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  1617.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  1618.  <META http-equiv="Pragma" content="no-cache"/>
  1619.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  1620. </HEAD>
  1621. <BODY class="scGridPage">
  1622. <FORM style="display:none;" name="form_ok" method="POST" action="<?php echo $NM_retorno?>" target="_self">
  1623. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  1624. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  1625. <INPUT type="hidden" name="nmgp_opcao" value="pesq"> 
  1626. </FORM>
  1627. <SCRIPT type="text/javascript">
  1628.  document.form_ok.submit();
  1629. </SCRIPT>
  1630. </BODY>
  1631. </HTML>
  1632. <?php
  1633. }

  1634.    /**
  1635.     * @access  public
  1636.     */
  1637.    function monta_html_ini()
  1638.    {
  1639. ?>
  1640. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  1641.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  1642. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  1643. <HEAD>
  1644.  <TITLE> </TITLE>
  1645.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  1646. <?php
  1647. if ($_SESSION['scriptcase']['proc_mobile'])
  1648. {
  1649. ?>
  1650.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  1651. <?php
  1652. }
  1653. ?>
  1654.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  1655.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  1656.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  1657.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  1658.  <META http-equiv="Pragma" content="no-cache"/>
  1659.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  1660.  <script type="text/javascript" src="<?php echo $this->Ini->path_prod ?>/third/jquery/js/jquery.js"></script>
  1661.  <script type="text/javascript" src="<?php echo $this->Ini->path_prod?>/third/jquery/js/jquery-ui.js"></script>
  1662.  <script type="text/javascript" src="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/malsup-blockui/jquery.blockUI.js"></script>
  1663.  <script type="text/javascript" src="../_lib/lib/js/scInput.js"></script>
  1664.  <script type="text/javascript" src="../_lib/lib/js/jquery.scInput.js"></script>
  1665.  <script type="text/javascript" src="../_lib/lib/js/jquery.scInput2.js"></script>
  1666.  <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/thickbox.css" type="text/css" media="screen" />
  1667.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_error.css" /> 
  1668.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_error<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  1669.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Str_btn_filter_css ?>" /> 
  1670.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_form.css" /> 
  1671.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_form<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  1672.  <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/jquery/css/smoothness/jquery-ui.css" type="text/css" media="screen" />
  1673.  <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/font-awesome/css/all.min.css" type="text/css" media="screen" />
  1674.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_filter.css" /> 
  1675.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_filter<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  1676.   <?php 
  1677.   if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts)) 
  1678.   { 
  1679.   ?> 
  1680.   <link href="<?php echo $this->Ini->str_google_fonts ?>" rel="stylesheet" /> 
  1681.   <?php 
  1682.   } 
  1683.   ?> 
  1684.  <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->path_link ?>grid_new/grid_new_fil_<?php echo strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) ?>.css" />
  1685. </HEAD>
  1686. <BODY class="scFilterPage">
  1687. <?php echo $this->Ini->Ajax_result_set ?>
  1688. <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_js "/browserSniffer.js" ?>"></SCRIPT>
  1689.    <script type="text/javascript">
  1690.      var applicationKeys = '';
  1691.      applicationKeys += 'ctrl+k';
  1692.      applicationKeys += ',';
  1693.      applicationKeys += 'ctrl+enter';
  1694.      applicationKeys += ',';
  1695.      applicationKeys += 'ctrl+e';
  1696.      applicationKeys += ',';
  1697.      applicationKeys += 'f1';
  1698.      applicationKeys += ',';
  1699.      applicationKeys += 'alt+q';
  1700.      var hotkeyList = '';
  1701.      function execHotKey(e, h) {
  1702.          var hotkey_fired = false
  1703.          switch (true) {
  1704.              case (['ctrl+k'].indexOf(h.key) > -1):
  1705.                  hotkey_fired = process_hotkeys('sys_format_lim');
  1706.                  break;
  1707.              case (['ctrl+enter'].indexOf(h.key) > -1):
  1708.                  hotkey_fired = process_hotkeys('sys_format_fi2');
  1709.                  break;
  1710.              case (['ctrl+e'].indexOf(h.key) > -1):
  1711.                  hotkey_fired = process_hotkeys('sys_format_edi');
  1712.                  break;
  1713.              case (['f1'].indexOf(h.key) > -1):
  1714.                  hotkey_fired = process_hotkeys('sys_format_webh');
  1715.                  break;
  1716.              case (['alt+q'].indexOf(h.key) > -1):
  1717.                  hotkey_fired = process_hotkeys('sys_format_sai');
  1718.                  break;
  1719.          }
  1720.          if (hotkey_fired) {
  1721.              e.preventDefault();
  1722.              return false;
  1723.          } else {
  1724.              return true;
  1725.          }
  1726.      }
  1727.    </script>
  1728.    <script type="text/javascript" src="../_lib/lib/js/hotkeys.inc.js"></script>
  1729.    <script type="text/javascript" src="../_lib/lib/js/hotkeys_setup.js"></script>
  1730.         <script type="text/javascript">
  1731.           var sc_pathToTB = '<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/';
  1732.           var sc_tbLangClose = "<?php echo html_entity_decode($this->Ini->Nm_lang['lang_tb_close'], ENT_COMPAT$_SESSION['scriptcase']['charset']) ?>";
  1733.           var sc_tbLangEsc = "<?php echo html_entity_decode($this->Ini->Nm_lang['lang_tb_esc'], ENT_COMPAT$_SESSION['scriptcase']['charset']) ?>";
  1734.         </script>
  1735.  <script type="text/javascript" src="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/thickbox-compressed.js"></script>
  1736.  <script type="text/javascript" src="grid_new_ajax_search.js"></script>
  1737.  <script type="text/javascript" src="grid_new_ajax.js"></script>
  1738.  <script type="text/javascript">
  1739.    function sc_session_redir(url_redir)
  1740.    {
  1741.        if (window.parent && window.parent.document != window.document && typeof window.parent.sc_session_redir === 'function')
  1742.        {
  1743.            window.parent.sc_session_redir(url_redir);
  1744.        }
  1745.        else
  1746.        {
  1747.            if (window.opener && typeof window.opener.sc_session_redir === 'function')
  1748.            {
  1749.                window.close();
  1750.                window.opener.sc_session_redir(url_redir);
  1751.            }
  1752.            else
  1753.            {
  1754.                window.location = url_redir;
  1755.            }
  1756.        }
  1757.    }
  1758.    var sc_ajaxBg = '<?php echo $this->Ini->Color_bg_ajax ?>';
  1759.    var sc_ajaxBordC = '<?php echo $this->Ini->Border_c_ajax ?>';
  1760.    var sc_ajaxBordS = '<?php echo $this->Ini->Border_s_ajax ?>';
  1761.    var sc_ajaxBordW = '<?php echo $this->Ini->Border_w_ajax ?>';
  1762.  </script>
  1763. <?php
  1764. $Cod_Btn nmButtonOutput($this->arr_buttons"berrm_clse""nmAjaxHideDebug()""nmAjaxHideDebug()"""""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  1765. ?>
  1766. <div id="id_debug_window" style="display: none; position: absolute; left: 50px; top: 50px"><table class="scFormMessageTable">
  1767. <tr><td class="scFormMessageTitle"><?php echo $Cod_Btn ?>&nbsp;&nbsp;Output</td></tr>
  1768. <tr><td class="scFormMessageMessage" style="padding: 0px; vertical-align: top"><div style="padding: 2px; height: 200px; width: 350px; overflow: auto" id="id_debug_text"></div></td></tr>
  1769. </table></div>
  1770. <script type="text/javascript" src="grid_new_message.js"></script>
  1771. <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_sweetalert.css" />
  1772. <script type="text/javascript" src="<?php echo $_SESSION['scriptcase']['grid_new']['glo_nm_path_prod']; ?>/third/sweetalert/sweetalert2.all.min.js"></script>
  1773. <script type="text/javascript" src="<?php echo $_SESSION['scriptcase']['grid_new']['glo_nm_path_prod']; ?>/third/sweetalert/polyfill.min.js"></script>
  1774. <script type="text/javascript" src="../_lib/lib/js/frameControl.js"></script>
  1775. <?php
  1776. $confirmButtonClass '';
  1777. $cancelButtonClass  '';
  1778. $confirmButtonText  $this->Ini->Nm_lang['lang_btns_cfrm'];
  1779. $cancelButtonText   $this->Ini->Nm_lang['lang_btns_cncl'];
  1780. $confirmButtonFA    '';
  1781. $cancelButtonFA     '';
  1782. $confirmButtonFAPos '';
  1783. $cancelButtonFAPos  '';
  1784. if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['style']) && '' != $this->arr_buttons['bsweetalert_ok']['style']) {
  1785.     $confirmButtonClass 'scButton_' $this->arr_buttons['bsweetalert_ok']['style'];
  1786. }
  1787. if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['style']) && '' != $this->arr_buttons['bsweetalert_cancel']['style']) {
  1788.     $cancelButtonClass 'scButton_' $this->arr_buttons['bsweetalert_cancel']['style'];
  1789. }
  1790. if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['value']) && '' != $this->arr_buttons['bsweetalert_ok']['value']) {
  1791.     $confirmButtonText $this->arr_buttons['bsweetalert_ok']['value'];
  1792. }
  1793. if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['value']) && '' != $this->arr_buttons['bsweetalert_cancel']['value']) {
  1794.     $cancelButtonText $this->arr_buttons['bsweetalert_cancel']['value'];
  1795. }
  1796. if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['fontawesomeicon']) && '' != $this->arr_buttons['bsweetalert_ok']['fontawesomeicon']) {
  1797.     $confirmButtonFA $this->arr_buttons['bsweetalert_ok']['fontawesomeicon'];
  1798. }
  1799. if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['fontawesomeicon']) && '' != $this->arr_buttons['bsweetalert_cancel']['fontawesomeicon']) {
  1800.     $cancelButtonFA $this->arr_buttons['bsweetalert_cancel']['fontawesomeicon'];
  1801. }
  1802. if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['display_position']) && 'img_right' != $this->arr_buttons['bsweetalert_ok']['display_position']) {
  1803.     $confirmButtonFAPos 'text_right';
  1804. }
  1805. if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['display_position']) && 'img_right' != $this->arr_buttons['bsweetalert_cancel']['display_position']) {
  1806.     $cancelButtonFAPos 'text_right';
  1807. }
  1808. ?>
  1809. <script type="text/javascript">
  1810.   var scSweetAlertConfirmButton = "<?php echo $confirmButtonClass ?>";
  1811.   var scSweetAlertCancelButton = "<?php echo $cancelButtonClass ?>";
  1812.   var scSweetAlertConfirmButtonText = "<?php echo $confirmButtonText ?>";
  1813.   var scSweetAlertCancelButtonText = "<?php echo $cancelButtonText ?>";
  1814.   var scSweetAlertConfirmButtonFA = "<?php echo $confirmButtonFA ?>";
  1815.   var scSweetAlertCancelButtonFA = "<?php echo $cancelButtonFA ?>";
  1816.   var scSweetAlertConfirmButtonFAPos = "<?php echo $confirmButtonFAPos ?>";
  1817.   var scSweetAlertCancelButtonFAPos = "<?php echo $cancelButtonFAPos ?>";
  1818. </script>
  1819. <script type="text/javascript">
  1820. $(function() {
  1821. <?php
  1822. if (count($this->nm_mens_alert) || count($this->Ini->nm_mens_alert)) {
  1823.    if (isset($this->Ini->nm_mens_alert) && !empty($this->Ini->nm_mens_alert))
  1824.    {
  1825.        if (isset($this->nm_mens_alert) && !empty($this->nm_mens_alert))
  1826.        {
  1827.            $this->nm_mens_alert   array_merge($this->Ini->nm_mens_alert$this->nm_mens_alert);
  1828.            $this->nm_params_alert array_merge($this->Ini->nm_params_alert$this->nm_params_alert);
  1829.        }
  1830.        else
  1831.        {
  1832.            $this->nm_mens_alert   $this->Ini->nm_mens_alert;
  1833.            $this->nm_params_alert $this->Ini->nm_params_alert;
  1834.        }
  1835.    }
  1836.    if (isset($this->nm_mens_alert) && !empty($this->nm_mens_alert))
  1837.    {
  1838.        foreach ($this->nm_mens_alert as $i_alert => $mensagem)
  1839.        {
  1840.            $alertParams = array();
  1841.            if (isset($this->nm_params_alert[$i_alert]))
  1842.            {
  1843.                foreach ($this->nm_params_alert[$i_alert] as $paramName => $paramValue)
  1844.                {
  1845.                    if (in_array($paramName, array('title''timer''confirmButtonText''confirmButtonFA''confirmButtonFAPos''cancelButtonText''cancelButtonFA''cancelButtonFAPos''footer''width''padding')))
  1846.                    {
  1847.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1848.                    }
  1849.                    elseif (in_array($paramName, array('showConfirmButton''showCancelButton''toast')) && in_array($paramValue, array(truefalse)))
  1850.                    {
  1851.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1852.                    }
  1853.                    elseif ('position' == $paramName && in_array($paramValue, array('top''top-start''top-end''center''center-start''center-end''bottom''bottom-start''bottom-end')))
  1854.                    {
  1855.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1856.                    }
  1857.                    elseif ('type' == $paramName && in_array($paramValue, array('warning''error''success''info''question')))
  1858.                    {
  1859.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1860.                    }
  1861.                    elseif ('background' == $paramName)
  1862.                    {
  1863.                        $image_param $paramValue;
  1864.                        preg_match_all('/url\(([\s])?(["|\'])?(.*?)(["|\'])?([\s])?\)/i'$paramValue$matchesPREG_PATTERN_ORDER);
  1865.                        if (isset($matches[3])) {
  1866.                            foreach ($matches[3] as $match) {
  1867.                                if ('http:' != substr($match05) && 'https:' != substr($match06) && '/' != substr($match01)) {
  1868.                                    $image_param str_replace($match"{$this->Ini->path_img_global}/{$match}"$image_param);
  1869.                                }
  1870.                            }
  1871.                        }
  1872.                        $paramValue $image_param;
  1873.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1874.                    }
  1875.                }
  1876.            }
  1877.            $jsonParams json_encode($alertParams);
  1878.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  1879.            { 
  1880.                $this->Ini->Arr_result['AlertJS'][] = NM_charset_to_utf8($mensagem);
  1881.                $this->Ini->Arr_result['AlertJSParam'][] = $alertParams;
  1882.            } 
  1883.            else 
  1884.            { 
  1885. ?>
  1886.        scJs_alert('<?php echo $mensagem ?>', <?php echo $jsonParams ?>);
  1887. <?php
  1888.            } 
  1889.        }
  1890.    }
  1891. }
  1892. ?>
  1893. });
  1894. </script>
  1895. <?php
  1896. if ('' != $this->Campos_Mens_erro) {
  1897. ?>
  1898. <script type="text/javascript">
  1899. $(function() {
  1900.     _nmAjaxShowMessage({title: "<?php echo $this->Ini->Nm_lang['lang_errm_errt']; ?>", message: "<?php echo $this->Campos_Mens_erro ?>", isModal: false, timeout: "", showButton: true, buttonLabel: "", topPos: "", leftPos: "", width: "", height: "", redirUrl: "", redirTarget: "", redirParam: "", showClose: false, showBodyIcon: false, isToast: false, toastPos: "", type: "error"});
  1901. });
  1902. </script>
  1903. <?php
  1904. }
  1905. ?>
  1906. <script type="text/javascript" src="grid_new_message.js"></script>
  1907.  <SCRIPT type="text/javascript">

  1908. <?php
  1909. if (is_file($this->Ini->root $this->Ini->path_link "_lib/js/tab_erro_" $this->Ini->str_lang ".js"))
  1910. {
  1911.     $Tb_err_js file($this->Ini->root $this->Ini->path_link "_lib/js/tab_erro_" $this->Ini->str_lang ".js");
  1912.     foreach ($Tb_err_js as $Lines)
  1913.     {
  1914.         if (NM_is_utf8($Lines) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  1915.         {
  1916.             $Lines sc_convert_encoding($Lines$_SESSION['scriptcase']['charset'], "UTF-8");
  1917.         }
  1918.         echo $Lines;
  1919.     }
  1920. }
  1921.  if (NM_is_utf8($Lines) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  1922.  {
  1923.     $Msg_Inval sc_convert_encoding("Inv�lido"$_SESSION['scriptcase']['charset'], "UTF-8");
  1924.  }
  1925. ?>
  1926. var SC_crit_inv = "<?php echo $Msg_Inval ?>";
  1927. var nmdg_Form = "F1";

  1928.  $(function() {

  1929.    SC_carga_evt_jquery();
  1930.    scLoadScInput('input:text.sc-js-input');
  1931.  });
  1932.  function nm_campos_between(nm_campo, nm_cond, nm_nome_obj)
  1933.  {
  1934.   if (nm_cond.value == "bw")
  1935.   {
  1936.    nm_campo.style.display = "";
  1937.   }
  1938.   else
  1939.   {
  1940.     if (nm_campo)
  1941.     {
  1942.       nm_campo.style.display = "none";
  1943.     }
  1944.   }
  1945.   if (document.getElementById('id_hide_' + nm_nome_obj))
  1946.   {
  1947.       if (nm_cond.value == "nu" || nm_cond.value == "nn" || nm_cond.value == "ep" || nm_cond.value == "ne")
  1948.       {
  1949.           document.getElementById('id_hide_' + nm_nome_obj).style.display = 'none';
  1950.       }
  1951.       else
  1952.       {
  1953.           document.getElementById('id_hide_' + nm_nome_obj).style.display = '';
  1954.       }
  1955.   }
  1956.  }
  1957.  function nm_save_form(pos)
  1958.  {
  1959.   if (pos == 'top' && document.F1.nmgp_save_name_top.value == '')
  1960.   {
  1961.       return;
  1962.   }
  1963.   if (pos == 'bot' && document.F1.nmgp_save_name_bot.value == '')
  1964.   {
  1965.       return;
  1966.   }
  1967.   if (pos == 'fields' && document.F1.nmgp_save_name_fields.value == '')
  1968.   {
  1969.       return;
  1970.   }
  1971.   var str_out = "";
  1972.   str_out += 'SC_proprietarios_idproprietario_cond#NMF#' + search_get_sel_txt('SC_proprietarios_idproprietario_cond') + '@NMF@';
  1973.   str_out += 'SC_proprietarios_idproprietario#NMF#' + search_get_text('SC_proprietarios_idproprietario') + '@NMF@';
  1974.   str_out += 'SC_proprietarios_nome_cond#NMF#' + search_get_sel_txt('SC_proprietarios_nome_cond') + '@NMF@';
  1975.   str_out += 'SC_proprietarios_nome#NMF#' + search_get_text('SC_proprietarios_nome') + '@NMF@';
  1976.   str_out += 'id_ac_proprietarios_nome#NMF#' + search_get_text('id_ac_proprietarios_nome') + '@NMF@';
  1977.   str_out += 'SC_proprietarios_sexo_cond#NMF#' + search_get_sel_txt('SC_proprietarios_sexo_cond') + '@NMF@';
  1978.   str_out += 'SC_proprietarios_sexo#NMF#' + search_get_text('SC_proprietarios_sexo') + '@NMF@';
  1979.   str_out += 'id_ac_proprietarios_sexo#NMF#' + search_get_text('id_ac_proprietarios_sexo') + '@NMF@';
  1980.   str_out += 'SC_proprietarios_cpf_cond#NMF#' + search_get_sel_txt('SC_proprietarios_cpf_cond') + '@NMF@';
  1981.   str_out += 'SC_proprietarios_cpf#NMF#' + search_get_text('SC_proprietarios_cpf') + '@NMF@';
  1982.   str_out += 'SC_NM_operador#NMF#' + search_get_text('SC_NM_operador');
  1983.   str_out  = str_out.replace(/[+]/g, "__NM_PLUS__");
  1984.   str_out  = str_out.replace(/[&]/g, "__NM_AMP__");
  1985.   str_out  = str_out.replace(/[%]/g, "__NM_PRC__");
  1986.   var save_name = search_get_text('SC_nmgp_save_name_' + pos);
  1987.   var save_opt  = search_get_sel_txt('SC_nmgp_save_option_' + pos);
  1988.   ajax_save_filter(save_name, save_opt, str_out, pos);
  1989.  }
  1990.  function nm_submit_filter(obj_sel, pos)
  1991.  {
  1992.   index = obj_sel.selectedIndex;
  1993.   if (index == -1 || obj_sel.options[index].value == "") 
  1994.   {
  1995.       return false;
  1996.   }
  1997.   ajax_select_filter(obj_sel.options[index].value);
  1998.  }
  1999.  function nm_submit_filter_del(pos)
  2000.  {
  2001.   obj_sel = document.F1.elements['NM_filters_del_' + pos];
  2002.   index   = obj_sel.selectedIndex;
  2003.   if (index == -1 || obj_sel.options[index].value == "") 
  2004.   {
  2005.       return false;
  2006.   }
  2007.   parm = obj_sel.options[index].value;
  2008.   ajax_delete_filter(parm);
  2009.  }
  2010.  function search_get_select(obj_id)
  2011.  {
  2012.     var index = document.getElementById(obj_id).selectedIndex;
  2013.     if (index != -1) {
  2014.         return document.getElementById(obj_id).options[index].value;
  2015.     }
  2016.     else {
  2017.         return '';
  2018.     }
  2019.  }
  2020.  function search_get_selmult(obj_id)
  2021.  {
  2022.     var obj = document.getElementById(obj_id);
  2023.     var val = "_NM_array_";
  2024.     for (iSelect = 0; iSelect < obj.length; iSelect++)
  2025.     {
  2026.         if (obj[iSelect].selected)
  2027.         {
  2028.             val += "#NMARR#" + obj[iSelect].value;
  2029.         }
  2030.     }
  2031.     return val;
  2032.  }
  2033.  function search_get_Dselelect(obj_id)
  2034.  {
  2035.     var obj = document.getElementById(obj_id);
  2036.     var val = "_NM_array_";
  2037.     for (iSelect = 0; iSelect < obj.length; iSelect++)
  2038.     {
  2039.          val += "#NMARR#" + obj[iSelect].value;
  2040.     }
  2041.     return val;
  2042.  }
  2043.  function search_get_radio(obj_id)
  2044.  {
  2045.     var val  = "";
  2046.     if (document.getElementById(obj_id)) {
  2047.        var Nobj = document.getElementById(obj_id).name;
  2048.        var obj  = document.getElementsByName(Nobj);
  2049.        for (iRadio = 0; iRadio < obj.length; iRadio++) {
  2050.            if (obj[iRadio].checked) {
  2051.                val = obj[iRadio].value;
  2052.            }
  2053.        }
  2054.     }
  2055.     return val;
  2056.  }
  2057.  function search_get_checkbox(obj_id)
  2058.  {
  2059.     var val  = "_NM_array_";
  2060.     if (document.getElementById(obj_id)) {
  2061.        var Nobj = document.getElementById(obj_id).name;
  2062.        var obj  = document.getElementsByName(Nobj);
  2063.        if (!obj.length) {
  2064.            if (obj.checked) {
  2065.                val += "#NMARR#" + obj.value;
  2066.            }
  2067.        }
  2068.        else {
  2069.            for (iCheck = 0; iCheck < obj.length; iCheck++) {
  2070.                if (obj[iCheck].checked) {
  2071.                    val += "#NMARR#" + obj[iCheck].value;
  2072.                }
  2073.            }
  2074.        }
  2075.     }
  2076.     return val;
  2077.  }
  2078.  function search_get_text(obj_id)
  2079.  {
  2080.     var obj = document.getElementById(obj_id);
  2081.     return (obj) ? obj.value : '';
  2082.  }
  2083.  function search_get_title(obj_id)
  2084.  {
  2085.     var obj = document.getElementById(obj_id);
  2086.     return (obj) ? obj.title : '';
  2087.  }
  2088.  function search_get_sel_txt(obj_id)
  2089.  {
  2090.     var val = "";
  2091.     obj_part  = document.getElementById(obj_id);
  2092.     if (obj_part && obj_part.type.substr(0, 6) == 'select')
  2093.     {
  2094.         val = search_get_select(obj_id);
  2095.     }
  2096.     else
  2097.     {
  2098.         val = (obj_part) ? obj_part.value : '';
  2099.     }
  2100.     return val;
  2101.  }
  2102.  function search_get_html(obj_id)
  2103.  {
  2104.     var obj = document.getElementById(obj_id);
  2105.     return obj.innerHTML;
  2106.  }
  2107. function nm_open_popup(parms)
  2108. {
  2109.     NovaJanela = window.open (parms, '', 'resizable, scrollbars');
  2110. }
  2111.  </SCRIPT>
  2112. <script type="text/javascript">
  2113.  $(function() {
  2114.    $("#id_ac_proprietarios_nome").autocomplete({
  2115.      minLength: 1,
  2116.      source: function (request, response) {
  2117.      $.ajax({
  2118.        url: "index.php",
  2119.        dataType: "json",
  2120.        data: {
  2121.           q: request.term,
  2122.           nmgp_opcao: "ajax_autocomp",
  2123.           nmgp_parms: "NM_ajax_opcao?#?autocomp_proprietarios_nome",
  2124.           max_itens: "10",
  2125.           cod_desc: "N",
  2126.           script_case_init: <?php echo $this->Ini->sc_page ?>
  2127.         },
  2128.        success: function (data) {
  2129.          if (data == "ss_time_out") {
  2130.              nm_move();
  2131.          }
  2132.          response(data);
  2133.        }
  2134.       });
  2135.     },
  2136.      select: function (event, ui) {
  2137.        $("#SC_proprietarios_nome").val(ui.item.value);
  2138.        $(this).val(ui.item.label);
  2139.        event.preventDefault();
  2140.      },
  2141.      focus: function (event, ui) {
  2142.        $("#SC_proprietarios_nome").val(ui.item.value);
  2143.        $(this).val(ui.item.label);
  2144.        event.preventDefault();
  2145.      },
  2146.      change: function (event, ui) {
  2147.        if (null == ui.item) {
  2148.           $("#SC_proprietarios_nome").val( $(this).val() );
  2149.        }
  2150.      }
  2151.    });
  2152.    $("#id_ac_proprietarios_sexo").autocomplete({
  2153.      minLength: 1,
  2154.      source: function (request, response) {
  2155.      $.ajax({
  2156.        url: "index.php",
  2157.        dataType: "json",
  2158.        data: {
  2159.           q: request.term,
  2160.           nmgp_opcao: "ajax_autocomp",
  2161.           nmgp_parms: "NM_ajax_opcao?#?autocomp_proprietarios_sexo",
  2162.           max_itens: "10",
  2163.           cod_desc: "N",
  2164.           script_case_init: <?php echo $this->Ini->sc_page ?>
  2165.         },
  2166.        success: function (data) {
  2167.          if (data == "ss_time_out") {
  2168.              nm_move();
  2169.          }
  2170.          response(data);
  2171.        }
  2172.       });
  2173.     },
  2174.      select: function (event, ui) {
  2175.        $("#SC_proprietarios_sexo").val(ui.item.value);
  2176.        $(this).val(ui.item.label);
  2177.        event.preventDefault();
  2178.      },
  2179.      focus: function (event, ui) {
  2180.        $("#SC_proprietarios_sexo").val(ui.item.value);
  2181.        $(this).val(ui.item.label);
  2182.        event.preventDefault();
  2183.      },
  2184.      change: function (event, ui) {
  2185.        if (null == ui.item) {
  2186.           $("#SC_proprietarios_sexo").val( $(this).val() );
  2187.        }
  2188.      }
  2189.    });
  2190.  });
  2191. </script>
  2192.  <FORM name="F1" action="./" method="post" target="_self"> 
  2193.  <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  2194.  <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  2195.  <INPUT type="hidden" name="nmgp_opcao" value="busca"> 
  2196.  <div id="idJSSpecChar" style="display:none;"></div>
  2197.  <div id="id_div_process" style="display: none; position: absolute"><table class="scFilterTable"><tr><td class="scFilterLabelOdd"><?php echo $this->Ini->Nm_lang['lang_othr_prcs']; ?>...</td></tr></table></div>
  2198.  <div id="id_fatal_error" class="scFilterFieldOdd" style="display:none; position: absolute"></div>
  2199. <TABLE id="main_table" align="center" valign="top" >
  2200. <tr>
  2201. <td>
  2202. <div class="scFilterBorder">
  2203.   <div id="id_div_process_block" style="display: none; margin: 10px; whitespace: nowrap"><span class="scFormProcess"><img border="0" src="<?php echo $this->Ini->path_icones ?>/scriptcase__NM__ajax_load.gif" align="absmiddle" />&nbsp;<?php echo $this->Ini->Nm_lang['lang_othr_prcs'?>...</span></div>
  2204. <table cellspacing=0 cellpadding=0 width='100%'>
  2205. <?php
  2206.    }

  2207.    /**
  2208.     * @access  public
  2209.     * @global  string  $bprocessa  
  2210.     */
  2211.    /**
  2212.     * @access  public
  2213.     */
  2214.    function monta_cabecalho()
  2215.    {
  2216.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['compact_mode'])
  2217.       {
  2218.           return;
  2219.       }
  2220.       $Str_date strtolower($_SESSION['scriptcase']['reg_conf']['date_format']);
  2221.       $Lim   strlen($Str_date);
  2222.       $Ult   "";
  2223.       $Arr_D = array();
  2224.       for ($I 0$I $Lim$I++)
  2225.       {
  2226.           $Char substr($Str_date$I1);
  2227.           if ($Char != $Ult)
  2228.           {
  2229.               $Arr_D[] = $Char;
  2230.           }
  2231.           $Ult $Char;
  2232.       }
  2233.       $Prim true;
  2234.       $Str  "";
  2235.       foreach ($Arr_D as $Cada_d)
  2236.       {
  2237.           $Str .= (!$Prim) ? $_SESSION['scriptcase']['reg_conf']['date_sep'] : "";
  2238.           $Str .= $Cada_d;
  2239.           $Prim false;
  2240.       }
  2241.       $Str str_replace("a""Y"$Str);
  2242.       $Str str_replace("y""Y"$Str);
  2243.       $nm_data_fixa date($Str); 
  2244. ?>
  2245.  <TR align="center">
  2246.   <TD class="scFilterTableTd">
  2247. <style>
  2248.     .scMenuTHeaderFont img, .scGridHeaderFont img , .scFormHeaderFont img , .scTabHeaderFont img , .scContainerHeaderFont img , .scFilterHeaderFont img { height:23px;}
  2249. </style>
  2250. <div class="scFilterHeader" style="height: 54px; padding: 17px 15px; box-sizing: border-box;margin: -1px 0px 0px 0px;width: 100%;">
  2251.     <div class="scFilterHeaderFont" style="float: left; text-transform: uppercase;"><?php echo $this->Ini->Nm_lang['lang_othr_srch_title'?> </div>
  2252.     <div class="scFilterHeaderFont" style="float: right;"><?php echo $nm_data_fixa?></div>
  2253. </div>  </TD>
  2254.  </TR>
  2255. <?php
  2256.    }

  2257.    /**
  2258.     * @access  public
  2259.     * @global  string  $nm_url_saida  $this->Ini->Nm_lang['pesq_global_nm_url_saida']
  2260.     * @global  integer  $nm_apl_dependente  $this->Ini->Nm_lang['pesq_global_nm_apl_dependente']
  2261.     * @global  string  $nmgp_parms  
  2262.     * @global  string  $bprocessa  $this->Ini->Nm_lang['pesq_global_bprocessa']
  2263.     */
  2264.    function monta_form()
  2265.    {
  2266.       global 
  2267.              $proprietarios_idproprietario_cond$proprietarios_idproprietario,
  2268.              $proprietarios_nome_cond$proprietarios_nome$proprietarios_nome_autocomp,
  2269.              $proprietarios_sexo_cond$proprietarios_sexo$proprietarios_sexo_autocomp,
  2270.              $proprietarios_cpf_cond$proprietarios_cpf,
  2271.              $nm_url_saida$nm_apl_dependente$nmgp_parms$bprocessa$nmgp_save_name$NM_operador$NM_filters$nmgp_save_option$NM_filters_del$Script_BI;
  2272.       $Script_BI "";
  2273.       $this->nmgp_botoes['clear'] = "on";
  2274.       $this->nmgp_botoes['save'] = "on";
  2275.       if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display']))
  2276.       {
  2277.           foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display'] as $NM_cada_btn => $NM_cada_opc)
  2278.           {
  2279.               $this->nmgp_botoes[$NM_cada_btn] = $NM_cada_opc;
  2280.           }
  2281.       }
  2282.       $this->aba_iframe false;
  2283.       if (isset($_SESSION['scriptcase']['sc_aba_iframe']))
  2284.       {
  2285.           foreach ($_SESSION['scriptcase']['sc_aba_iframe'] as $aba => $apls_aba)
  2286.           {
  2287.               if (in_array("grid_new"$apls_aba))
  2288.               {
  2289.                   $this->aba_iframe true;
  2290.                   break;
  2291.               }
  2292.           }
  2293.       }
  2294.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['iframe_menu'] && (!isset($_SESSION['scriptcase']['menu_mobile']) || empty($_SESSION['scriptcase']['menu_mobile'])))
  2295.       {
  2296.           $this->aba_iframe true;
  2297.       }
  2298.       $nmgp_tab_label "";
  2299.       $delimitador "##@@";
  2300.       if (empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && $bprocessa != "recarga" && $bprocessa != "save_form" && $bprocessa != "filter_save" && $bprocessa != "filter_delete")
  2301.       {
  2302.       }
  2303.       if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && $bprocessa != "recarga" && $bprocessa != "save_form" && $bprocessa != "filter_save" && $bprocessa != "filter_delete")
  2304.       { 
  2305.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  2306.           {
  2307.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = NM_conv_charset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'], $_SESSION['scriptcase']['charset'], "UTF-8");
  2308.           }
  2309.           $proprietarios_idproprietario $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_idproprietario']; 
  2310.           $proprietarios_idproprietario_cond $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_idproprietario_cond']; 
  2311.           $proprietarios_nome $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_nome']; 
  2312.           $proprietarios_nome_cond $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_nome_cond']; 
  2313.           $proprietarios_sexo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_sexo']; 
  2314.           $proprietarios_sexo_cond $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_sexo_cond']; 
  2315.           $proprietarios_cpf $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_cpf']; 
  2316.           $proprietarios_cpf_cond $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_cpf_cond']; 
  2317.           $this->NM_operador $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['NM_operador']; 
  2318.           if (strtoupper($proprietarios_idproprietario_cond) != "II" && strtoupper($proprietarios_idproprietario_cond) != "QP" && strtoupper($proprietarios_idproprietario_cond) != "NP" && strtoupper($proprietarios_idproprietario_cond) != "IN"
  2319.           { 
  2320.               nmgp_Form_Num_Val($proprietarios_idproprietario$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  2321.           } 
  2322.           if (strtoupper($proprietarios_cpf_cond) != "II" && strtoupper($proprietarios_cpf_cond) != "QP" && strtoupper($proprietarios_cpf_cond) != "NP" && strtoupper($proprietarios_cpf_cond) != "IN"
  2323.           { 
  2324.               nmgp_Form_Num_Val($proprietarios_cpf$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  2325.           } 
  2326.       } 
  2327.       if (!isset($proprietarios_idproprietario_cond) || empty($proprietarios_idproprietario_cond))
  2328.       {
  2329.          $proprietarios_idproprietario_cond "gt";
  2330.       }
  2331.       if (!isset($proprietarios_nome_cond) || empty($proprietarios_nome_cond))
  2332.       {
  2333.          $proprietarios_nome_cond "qp";
  2334.       }
  2335.       if (!isset($proprietarios_sexo_cond) || empty($proprietarios_sexo_cond))
  2336.       {
  2337.          $proprietarios_sexo_cond "qp";
  2338.       }
  2339.       if (!isset($proprietarios_cpf_cond) || empty($proprietarios_cpf_cond))
  2340.       {
  2341.          $proprietarios_cpf_cond "gt";
  2342.       }
  2343.       $display_aberto  "style=display:";
  2344.       $display_fechado "style=display:none";
  2345.       $opc_hide_input = array("nu","nn","ep","ne");
  2346.       $str_hide_proprietarios_idproprietario = (in_array($proprietarios_idproprietario_cond$opc_hide_input)) ? $display_fechado $display_aberto;
  2347.       $str_hide_proprietarios_nome = (in_array($proprietarios_nome_cond$opc_hide_input)) ? $display_fechado $display_aberto;
  2348.       $str_hide_proprietarios_sexo = (in_array($proprietarios_sexo_cond$opc_hide_input)) ? $display_fechado $display_aberto;
  2349.       $str_hide_proprietarios_cpf = (in_array($proprietarios_cpf_cond$opc_hide_input)) ? $display_fechado $display_aberto;

  2350.       if (!isset($proprietarios_idproprietario) || $proprietarios_idproprietario == "")
  2351.       {
  2352.           $proprietarios_idproprietario "";
  2353.       }
  2354.       if (isset($proprietarios_idproprietario) && !empty($proprietarios_idproprietario))
  2355.       {
  2356.          $tmp_pos strpos($proprietarios_idproprietario"##@@");
  2357.          if ($tmp_pos === false)
  2358.          { }
  2359.          else
  2360.          {
  2361.          $proprietarios_idproprietario substr($proprietarios_idproprietario0$tmp_pos);
  2362.          }
  2363.       }
  2364.       if (!isset($proprietarios_nome) || $proprietarios_nome == "")
  2365.       {
  2366.           $proprietarios_nome "";
  2367.       }
  2368.       if (isset($proprietarios_nome) && !empty($proprietarios_nome))
  2369.       {
  2370.          $tmp_pos strpos($proprietarios_nome"##@@");
  2371.          if ($tmp_pos === false)
  2372.          { }
  2373.          else
  2374.          {
  2375.          $proprietarios_nome substr($proprietarios_nome0$tmp_pos);
  2376.          }
  2377.       }
  2378.       if (!isset($proprietarios_sexo) || $proprietarios_sexo == "")
  2379.       {
  2380.           $proprietarios_sexo "";
  2381.       }
  2382.       if (isset($proprietarios_sexo) && !empty($proprietarios_sexo))
  2383.       {
  2384.          $tmp_pos strpos($proprietarios_sexo"##@@");
  2385.          if ($tmp_pos === false)
  2386.          { }
  2387.          else
  2388.          {
  2389.          $proprietarios_sexo substr($proprietarios_sexo0$tmp_pos);
  2390.          }
  2391.       }
  2392.       if (!isset($proprietarios_cpf) || $proprietarios_cpf == "")
  2393.       {
  2394.           $proprietarios_cpf "";
  2395.       }
  2396.       if (isset($proprietarios_cpf) && !empty($proprietarios_cpf))
  2397.       {
  2398.          $tmp_pos strpos($proprietarios_cpf"##@@");
  2399.          if ($tmp_pos === false)
  2400.          { }
  2401.          else
  2402.          {
  2403.          $proprietarios_cpf substr($proprietarios_cpf0$tmp_pos);
  2404.          }
  2405.       }
  2406. ?>
  2407.  <TR align="center">
  2408.   <TD class="scFilterTableTd">
  2409.    <TABLE style="padding: 0px; spacing: 0px; border-width: 0px;" width="100%" height="100%">
  2410.    <TR valign="top" >
  2411.   <TD width="100%" height="">
  2412.    <TABLE class="scFilterTable" id="hidden_bloco_0" valign="top" width="100%" style="height: 100%;">
  2413.    <tr>



  2414.    
  2415.     <TD nowrap class="scFilterLabelOdd" style="vertical-align: top" > <?php
  2416.  $SC_Label = (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario";
  2417.  $nmgp_tab_label .= "proprietarios_idproprietario?#?" $SC_Label "?@?";
  2418.  $date_sep_bw " " $this->Ini->Nm_lang['lang_srch_between_values'] . " ";
  2419.  if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($date_sep_bw))
  2420.  {
  2421.      $date_sep_bw sc_convert_encoding($date_sep_bw$_SESSION['scriptcase']['charset'], "UTF-8");
  2422.  }
  2423. ?>
  2424. <span class="SC_Field_label_Mob"><?php echo $SC_Label ?></span><br>
  2425.       <SELECT class="SC_Cond_Selector scFilterObjectOdd" id="SC_proprietarios_idproprietario_cond" name="proprietarios_idproprietario_cond" onChange="nm_campos_between(document.getElementById('id_vis_proprietarios_idproprietario'), this, 'proprietarios_idproprietario')">
  2426.        <OPTION value="gt" <?php if ("gt" == $proprietarios_idproprietario_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_grtr'?></OPTION>
  2427.        <OPTION value="lt" <?php if ("lt" == $proprietarios_idproprietario_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_less'?></OPTION>
  2428.        <OPTION value="eq" <?php if ("eq" == $proprietarios_idproprietario_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_exac'?></OPTION>
  2429.       </SELECT>
  2430.       <br><span id="id_hide_proprietarios_idproprietario"  <?php echo $str_hide_proprietarios_idproprietario?>><INPUT  type="text" id="SC_proprietarios_idproprietario" name="proprietarios_idproprietario" value="<?php echo NM_encode_input($proprietarios_idproprietario?>" size=11 alt="{datatype: 'integer', maxLength: 11, thousandsSep: '<?php echo $_SESSION['scriptcase']['reg_conf']['grup_num'?>', allowNegative: false, onlyNegative: false, enterTab: false}" class="sc-js-input scFilterObjectOdd">
  2431.  </TD>
  2432.    



  2433.    </tr><tr>



  2434.    
  2435.     <TD nowrap class="scFilterLabelEven" style="vertical-align: top" > <?php
  2436.  $SC_Label = (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome";
  2437.  $nmgp_tab_label .= "proprietarios_nome?#?" $SC_Label "?@?";
  2438.  $date_sep_bw " " $this->Ini->Nm_lang['lang_srch_between_values'] . " ";
  2439.  if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($date_sep_bw))
  2440.  {
  2441.      $date_sep_bw sc_convert_encoding($date_sep_bw$_SESSION['scriptcase']['charset'], "UTF-8");
  2442.  }
  2443. ?>
  2444. <span class="SC_Field_label_Mob"><?php echo $SC_Label ?></span><br>
  2445.       <SELECT class="SC_Cond_Selector scFilterObjectEven" id="SC_proprietarios_nome_cond" name="proprietarios_nome_cond" onChange="nm_campos_between(document.getElementById('id_vis_proprietarios_nome'), this, 'proprietarios_nome')">
  2446.        <OPTION value="qp" <?php if ("qp" == $proprietarios_nome_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_like'?></OPTION>
  2447.        <OPTION value="np" <?php if ("np" == $proprietarios_nome_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_not_like'?></OPTION>
  2448.        <OPTION value="eq" <?php if ("eq" == $proprietarios_nome_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_exac'?></OPTION>
  2449.        <OPTION value="ep" <?php if ("ep" == $proprietarios_nome_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_empty'?></OPTION>
  2450.       </SELECT>
  2451.       <br><span id="id_hide_proprietarios_nome"  <?php echo $str_hide_proprietarios_nome?>><?php
  2452.       if ($proprietarios_nome != "")
  2453.       {
  2454.       $proprietarios_nome_look substr($this->Db->qstr($proprietarios_nome), 1, -1); 
  2455.       $nmgp_def_dados = array(); 
  2456.       $nm_comando "select distinct Proprietarios.Nome from " $this->Ini->nm_tabela " where Proprietarios.Nome = '$proprietarios_nome_look' order by Proprietarios.Nome"
  2457.       unset($cmp1,$cmp2);
  2458.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  2459.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  2460.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  2461.       { 
  2462.          while (!$rs->EOF
  2463.          { 
  2464.             $cmp1 trim($rs->fields[0]);
  2465.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  2466.             $rs->MoveNext() ; 
  2467.          } 
  2468.          $rs->Close() ; 
  2469.       } 
  2470.       else  
  2471.       {  
  2472.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  2473.          exit; 
  2474.       } 
  2475.       }
  2476.       if (isset($nmgp_def_dados[0][$proprietarios_nome]))
  2477.       {
  2478.           $sAutocompValue $nmgp_def_dados[0][$proprietarios_nome];
  2479.       }
  2480.       else
  2481.       {
  2482.           $sAutocompValue $proprietarios_nome;
  2483.       }
  2484. ?>
  2485. <INPUT  type="text" id="SC_proprietarios_nome" name="proprietarios_nome" value="<?php echo NM_encode_input($proprietarios_nome?>"  size=45 alt="{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}" style="display: none">
  2486. <input class="sc-js-input scFilterObjectEven" type="text" id="id_ac_proprietarios_nome" name="proprietarios_nome_autocomp" size="45"  value="<?php echo NM_encode_input($sAutocompValue); ?>" alt="{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}">

  2487.  </TD>
  2488.    



  2489.    </tr><tr>



  2490.    
  2491.     <TD nowrap class="scFilterLabelOdd" style="vertical-align: top" > <?php
  2492.  $SC_Label = (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo";
  2493.  $nmgp_tab_label .= "proprietarios_sexo?#?" $SC_Label "?@?";
  2494.  $date_sep_bw " " $this->Ini->Nm_lang['lang_srch_between_values'] . " ";
  2495.  if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($date_sep_bw))
  2496.  {
  2497.      $date_sep_bw sc_convert_encoding($date_sep_bw$_SESSION['scriptcase']['charset'], "UTF-8");
  2498.  }
  2499. ?>
  2500. <span class="SC_Field_label_Mob"><?php echo $SC_Label ?></span><br>
  2501.       <SELECT class="SC_Cond_Selector scFilterObjectOdd" id="SC_proprietarios_sexo_cond" name="proprietarios_sexo_cond" onChange="nm_campos_between(document.getElementById('id_vis_proprietarios_sexo'), this, 'proprietarios_sexo')">
  2502.        <OPTION value="qp" <?php if ("qp" == $proprietarios_sexo_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_like'?></OPTION>
  2503.        <OPTION value="np" <?php if ("np" == $proprietarios_sexo_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_not_like'?></OPTION>
  2504.        <OPTION value="eq" <?php if ("eq" == $proprietarios_sexo_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_exac'?></OPTION>
  2505.        <OPTION value="ep" <?php if ("ep" == $proprietarios_sexo_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_empty'?></OPTION>
  2506.       </SELECT>
  2507.       <br><span id="id_hide_proprietarios_sexo"  <?php echo $str_hide_proprietarios_sexo?>><?php
  2508.       if ($proprietarios_sexo != "")
  2509.       {
  2510.       $proprietarios_sexo_look substr($this->Db->qstr($proprietarios_sexo), 1, -1); 
  2511.       $nmgp_def_dados = array(); 
  2512.       $nm_comando "select distinct Proprietarios.Sexo from " $this->Ini->nm_tabela " where Proprietarios.Sexo = '$proprietarios_sexo_look' order by Proprietarios.Sexo"
  2513.       unset($cmp1,$cmp2);
  2514.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  2515.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  2516.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  2517.       { 
  2518.          while (!$rs->EOF
  2519.          { 
  2520.             $cmp1 trim($rs->fields[0]);
  2521.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  2522.             $rs->MoveNext() ; 
  2523.          } 
  2524.          $rs->Close() ; 
  2525.       } 
  2526.       else  
  2527.       {  
  2528.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  2529.          exit; 
  2530.       } 
  2531.       }
  2532.       if (isset($nmgp_def_dados[0][$proprietarios_sexo]))
  2533.       {
  2534.           $sAutocompValue $nmgp_def_dados[0][$proprietarios_sexo];
  2535.       }
  2536.       else
  2537.       {
  2538.           $sAutocompValue $proprietarios_sexo;
  2539.       }
  2540. ?>
  2541. <INPUT  type="text" id="SC_proprietarios_sexo" name="proprietarios_sexo" value="<?php echo NM_encode_input($proprietarios_sexo?>"  size=45 alt="{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}" style="display: none">
  2542. <input class="sc-js-input scFilterObjectOdd" type="text" id="id_ac_proprietarios_sexo" name="proprietarios_sexo_autocomp" size="45"  value="<?php echo NM_encode_input($sAutocompValue); ?>" alt="{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}">

  2543.  </TD>
  2544.    



  2545.    </tr><tr>



  2546.    
  2547.     <TD nowrap class="scFilterLabelEven" style="vertical-align: top" > <?php
  2548.  $SC_Label = (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf";
  2549.  $nmgp_tab_label .= "proprietarios_cpf?#?" $SC_Label "?@?";
  2550.  $date_sep_bw " " $this->Ini->Nm_lang['lang_srch_between_values'] . " ";
  2551.  if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($date_sep_bw))
  2552.  {
  2553.      $date_sep_bw sc_convert_encoding($date_sep_bw$_SESSION['scriptcase']['charset'], "UTF-8");
  2554.  }
  2555. ?>
  2556. <span class="SC_Field_label_Mob"><?php echo $SC_Label ?></span><br>
  2557.       <SELECT class="SC_Cond_Selector scFilterObjectEven" id="SC_proprietarios_cpf_cond" name="proprietarios_cpf_cond" onChange="nm_campos_between(document.getElementById('id_vis_proprietarios_cpf'), this, 'proprietarios_cpf')">
  2558.        <OPTION value="gt" <?php if ("gt" == $proprietarios_cpf_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_grtr'?></OPTION>
  2559.        <OPTION value="lt" <?php if ("lt" == $proprietarios_cpf_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_less'?></OPTION>
  2560.        <OPTION value="eq" <?php if ("eq" == $proprietarios_cpf_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_exac'?></OPTION>
  2561.       </SELECT>
  2562.       <br><span id="id_hide_proprietarios_cpf"  <?php echo $str_hide_proprietarios_cpf?>><INPUT  type="text" id="SC_proprietarios_cpf" name="proprietarios_cpf" value="<?php echo NM_encode_input($proprietarios_cpf?>" size=11 alt="{datatype: 'integer', maxLength: 11, thousandsSep: '<?php echo $_SESSION['scriptcase']['reg_conf']['grup_num'?>', allowNegative: false, onlyNegative: false, enterTab: false}" class="sc-js-input scFilterObjectEven">
  2563.  </TD>
  2564.    



  2565.    </tr>
  2566.    </TABLE>
  2567.   </TD>
  2568.  </TR>
  2569.  </TABLE>
  2570.  </TD>
  2571.  </TR>
  2572.  <TR>
  2573.   <TD class="scFilterTableTd" align="center">
  2574. <INPUT type="hidden" id="SC_NM_operador" name="NM_operador" value="and">  </TD>
  2575.  </TR>
  2576.    <INPUT type="hidden" name="nmgp_tab_label" value="<?php echo NM_encode_input($nmgp_tab_label); ?>"> 
  2577.    <INPUT type="hidden" name="bprocessa" value="pesq"> 
  2578. <?php
  2579.     $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'] = $nmgp_tab_label;
  2580. ?>
  2581.  <?php
  2582.      if ($_SESSION['scriptcase']['proc_mobile'])
  2583.      {
  2584.      ?>
  2585.  <TR align="center">
  2586.   <TD class="scFilterTableTd">
  2587.    <table width="100%" class="scFilterToolbar"><tr>
  2588.     <td class="scFilterToolbarPadding" align="left" width="33%" nowrap>
  2589.     </td>
  2590.     <td class="scFilterToolbarPadding" align="center" width="33%" nowrap>
  2591.    <?php echo nmButtonOutput($this->arr_buttons"bpesquisa""document.F1.bprocessa.value='pesq'; setTimeout(function() {nm_submit_form()}, 200);""document.F1.bprocessa.value='pesq'; setTimeout(function() {nm_submit_form()}, 200);""sc_b_pesq_bot""""" $this->Ini->Nm_lang['lang_btns_srch_lone'] . """""absmiddle""""0px"$this->Ini->path_botoes"""" $this->Ini->Nm_lang['lang_btns_srch_lone_hint'] . """""""""only_text""text_right""""""""""""""");
  2592. ?>
  2593. <?php
  2594.    if ($this->nmgp_botoes['clear'] == "on")
  2595.    {
  2596. ?>
  2597.           <?php echo nmButtonOutput($this->arr_buttons"blimpar""limpa_form();""limpa_form();""limpa_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2598. ?>
  2599. <?php
  2600.    }
  2601. ?>
  2602. <?php
  2603.    if (!isset($this->nmgp_botoes['save']) || $this->nmgp_botoes['save'] == "on")
  2604.    {
  2605.        $this->NM_fil_ant $this->gera_array_filtros();
  2606. ?>
  2607.      <span id="idAjaxSelect_NM_filters_bot">
  2608.        <SELECT class="scFilterToolbar_obj" id="sel_recup_filters_bot" name="NM_filters_bot" onChange="nm_submit_filter(this, 'bot');" size="1">
  2609.            <option value=""></option>
  2610. <?php
  2611.           $Nome_filter "";
  2612.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  2613.           {
  2614.               $Select "";
  2615.               if ($Cada_filter == $this->NM_curr_fil)
  2616.               {
  2617.                   $Select "selected";
  2618.               }
  2619.               if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  2620.               {
  2621.                   $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  2622.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  2623.               }
  2624.               elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  2625.               {
  2626.                   $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  2627.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  2628.               }
  2629.               if ($Tipo_filter[1] != $Nome_filter)
  2630.               {
  2631.                   $Nome_filter $Tipo_filter[1];
  2632.                   echo "           <option value=\"\">" NM_encode_input($Nome_filter) . "</option>\r\n";
  2633.               }
  2634. ?>
  2635.            <option value="<?php echo NM_encode_input($Tipo_filter[0]) . "\" " $Select ">.." $Cada_filter ?></option>
  2636. <?php
  2637.           }
  2638. ?>
  2639.        </SELECT>
  2640.      </span>
  2641. <?php
  2642.    }
  2643. ?>
  2644. <?php
  2645.    if ($this->nmgp_botoes['save'] == "on")
  2646.    {
  2647. ?>
  2648.           <?php echo nmButtonOutput($this->arr_buttons"bedit_filter""document.getElementById('Salvar_filters_bot').style.display = ''; document.F1.nmgp_save_name_bot.focus();""document.getElementById('Salvar_filters_bot').style.display = ''; document.F1.nmgp_save_name_bot.focus();""Ativa_save_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2649. ?>
  2650. <?php
  2651.    }
  2652. ?>
  2653. <?php
  2654.    if (is_file("grid_new_help.txt"))
  2655.    {
  2656.       $Arq_WebHelp file("grid_new_help.txt"); 
  2657.       if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
  2658.       {
  2659.           $Arq_WebHelp[0] = str_replace("\r\n" ""trim($Arq_WebHelp[0]));
  2660.           $Tmp explode(";"$Arq_WebHelp[0]); 
  2661.           foreach ($Tmp as $Cada_help)
  2662.           {
  2663.               $Tmp1 explode(":"$Cada_help); 
  2664.               if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "fil" && is_file($this->Ini->root $this->Ini->path_help $Tmp1[1]))
  2665.               {
  2666. ?>
  2667.           <?php echo nmButtonOutput($this->arr_buttons"bhelp""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""sc_b_help_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2668. ?>
  2669. <?php
  2670.               }
  2671.           }
  2672.       }
  2673.    }
  2674. ?>
  2675. <?php
  2676.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start'] == 'filter' && $nm_apl_dependente != 1)
  2677.    {
  2678. ?>
  2679.        <?php echo nmButtonOutput($this->arr_buttons"bsair""document.form_cancel.submit();""document.form_cancel.submit();""sc_b_cancel_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2680. ?>
  2681. <?php
  2682.    }
  2683.    else
  2684.    {
  2685. ?>
  2686.        <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.form_cancel.submit();""document.form_cancel.submit();""sc_b_cancel_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2687. ?>
  2688. <?php
  2689.    }
  2690. ?>
  2691.     </td>
  2692.     <td class="scFilterToolbarPadding" align="right" width="33%" nowrap>
  2693.     </td>
  2694.    </tr></table>
  2695. <?php
  2696.    if ($this->nmgp_botoes['save'] == "on")
  2697.    {
  2698. ?>
  2699.     </TD></TR><TR><TD>
  2700.     <DIV id="Salvar_filters_bot" style="display:none;z-index:9999;">
  2701.      <TABLE align="center" class="scFilterTable">
  2702.       <TR>
  2703.        <TD class="scFilterBlock">
  2704.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2705.          <tr>
  2706.           <td style="padding: 0px" valign="top" class="scFilterBlockFont"><?php echo $this->Ini->Nm_lang['lang_othr_srch_head'?></td>
  2707.           <td style="padding: 0px" align="right" valign="top">
  2708.            <?php echo nmButtonOutput($this->arr_buttons"bcancelar_appdiv""document.getElementById('Salvar_filters_bot').style.display = 'none';""document.getElementById('Salvar_filters_bot').style.display = 'none';""Cancel_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2709. ?>
  2710.           </td>
  2711.          </tr>
  2712.         </table>
  2713.        </TD>
  2714.       </TR>
  2715.       <TR>
  2716.        <TD class="scFilterFieldOdd">
  2717.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2718.          <tr>
  2719.           <td style="padding: 0px" valign="top">
  2720.            <input class="scFilterObjectOdd" type="text" id="SC_nmgp_save_name_bot" name="nmgp_save_name_bot" value="">
  2721.           </td>
  2722.           <td style="padding: 0px" align="right" valign="top">
  2723.            <?php echo nmButtonOutput($this->arr_buttons"bsalvar_appdiv""nm_save_form('bot');""nm_save_form('bot');""Save_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2724. ?>
  2725.           </td>
  2726.          </tr>
  2727.         </table>
  2728.        </TD>
  2729.       </TR>
  2730.       <TR>
  2731.        <TD class="scFilterFieldEven">
  2732.        <DIV id="Apaga_filters_bot" style="display:''">
  2733.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2734.          <tr>
  2735.           <td style="padding: 0px" valign="top">
  2736.           <div id="idAjaxSelect_NM_filters_del_bot">
  2737.            <SELECT class="scFilterObjectOdd" id="sel_filters_del_bot" name="NM_filters_del_bot" size="1">
  2738.             <option value=""></option>
  2739. <?php
  2740.           $Nome_filter "";
  2741.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  2742.           {
  2743.               $Select "";
  2744.               if ($Cada_filter == $this->NM_curr_fil)
  2745.               {
  2746.                   $Select "selected";
  2747.               }
  2748.               if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  2749.               {
  2750.                   $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  2751.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  2752.               }
  2753.               elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  2754.               {
  2755.                   $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  2756.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  2757.               }
  2758.               if ($Tipo_filter[1] != $Nome_filter)
  2759.               {
  2760.                   $Nome_filter $Tipo_filter[1];
  2761.                   echo "            <option value=\"\">" NM_encode_input($Nome_filter) . "</option>\r\n";
  2762.               }
  2763. ?>
  2764.             <option value="<?php echo NM_encode_input($Tipo_filter[0]) . "\" " $Select ">.." $Cada_filter ?></option>
  2765. <?php
  2766.           }
  2767. ?>
  2768.            </SELECT>
  2769.           </div>
  2770.           </td>
  2771.           <td style="padding: 0px" align="right" valign="top">
  2772.            <?php echo nmButtonOutput($this->arr_buttons"bexcluir_appdiv""nm_submit_filter_del('bot');""nm_submit_filter_del('bot');""Exc_filtro_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2773. ?>
  2774.           </td>
  2775.          </tr>
  2776.         </table>
  2777.        </DIV>
  2778.        </TD>
  2779.       </TR>
  2780.      </TABLE>
  2781.     </DIV> 
  2782. <?php
  2783.    }
  2784. ?>
  2785.   </TD>
  2786.  </TR>
  2787.      <?php
  2788.      }
  2789.      else
  2790.      {
  2791.      ?>
  2792.  <TR align="center">
  2793.   <TD class="scFilterTableTd">
  2794.    <table width="100%" class="scFilterToolbar"><tr>
  2795.     <td class="scFilterToolbarPadding" align="left" width="33%" nowrap>
  2796.     </td>
  2797.     <td class="scFilterToolbarPadding" align="center" width="33%" nowrap>
  2798.    <?php echo nmButtonOutput($this->arr_buttons"bpesquisa""document.F1.bprocessa.value='pesq'; setTimeout(function() {nm_submit_form()}, 200);""document.F1.bprocessa.value='pesq'; setTimeout(function() {nm_submit_form()}, 200);""sc_b_pesq_bot""""" $this->Ini->Nm_lang['lang_btns_srch_lone'] . """""absmiddle""""0px"$this->Ini->path_botoes"""" $this->Ini->Nm_lang['lang_btns_srch_lone_hint'] . """""""""only_text""text_right""""""""""""""");
  2799. ?>
  2800. <?php
  2801.    if ($this->nmgp_botoes['clear'] == "on")
  2802.    {
  2803. ?>
  2804.           <?php echo nmButtonOutput($this->arr_buttons"blimpar""limpa_form();""limpa_form();""limpa_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2805. ?>
  2806. <?php
  2807.    }
  2808. ?>
  2809. <?php
  2810.    if (!isset($this->nmgp_botoes['save']) || $this->nmgp_botoes['save'] == "on")
  2811.    {
  2812.        $this->NM_fil_ant $this->gera_array_filtros();
  2813. ?>
  2814.      <span id="idAjaxSelect_NM_filters_bot">
  2815.        <SELECT class="scFilterToolbar_obj" id="sel_recup_filters_bot" name="NM_filters_bot" onChange="nm_submit_filter(this, 'bot');" size="1">
  2816.            <option value=""></option>
  2817. <?php
  2818.           $Nome_filter "";
  2819.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  2820.           {
  2821.               $Select "";
  2822.               if ($Cada_filter == $this->NM_curr_fil)
  2823.               {
  2824.                   $Select "selected";
  2825.               }
  2826.               if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  2827.               {
  2828.                   $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  2829.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  2830.               }
  2831.               elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  2832.               {
  2833.                   $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  2834.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  2835.               }
  2836.               if ($Tipo_filter[1] != $Nome_filter)
  2837.               {
  2838.                   $Nome_filter $Tipo_filter[1];
  2839.                   echo "           <option value=\"\">" NM_encode_input($Nome_filter) . "</option>\r\n";
  2840.               }
  2841. ?>
  2842.            <option value="<?php echo NM_encode_input($Tipo_filter[0]) . "\" " $Select ">.." $Cada_filter ?></option>
  2843. <?php
  2844.           }
  2845. ?>
  2846.        </SELECT>
  2847.      </span>
  2848. <?php
  2849.    }
  2850. ?>
  2851. <?php
  2852.    if ($this->nmgp_botoes['save'] == "on")
  2853.    {
  2854. ?>
  2855.           <?php echo nmButtonOutput($this->arr_buttons"bedit_filter""document.getElementById('Salvar_filters_bot').style.display = ''; document.F1.nmgp_save_name_bot.focus();""document.getElementById('Salvar_filters_bot').style.display = ''; document.F1.nmgp_save_name_bot.focus();""Ativa_save_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2856. ?>
  2857. <?php
  2858.    }
  2859. ?>
  2860. <?php
  2861.    if (is_file("grid_new_help.txt"))
  2862.    {
  2863.       $Arq_WebHelp file("grid_new_help.txt"); 
  2864.       if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
  2865.       {
  2866.           $Arq_WebHelp[0] = str_replace("\r\n" ""trim($Arq_WebHelp[0]));
  2867.           $Tmp explode(";"$Arq_WebHelp[0]); 
  2868.           foreach ($Tmp as $Cada_help)
  2869.           {
  2870.               $Tmp1 explode(":"$Cada_help); 
  2871.               if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "fil" && is_file($this->Ini->root $this->Ini->path_help $Tmp1[1]))
  2872.               {
  2873. ?>
  2874.           <?php echo nmButtonOutput($this->arr_buttons"bhelp""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""sc_b_help_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2875. ?>
  2876. <?php
  2877.               }
  2878.           }
  2879.       }
  2880.    }
  2881. ?>
  2882. <?php
  2883.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start'] == 'filter' && $nm_apl_dependente != 1)
  2884.    {
  2885. ?>
  2886.        <?php echo nmButtonOutput($this->arr_buttons"bsair""document.form_cancel.submit();""document.form_cancel.submit();""sc_b_cancel_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2887. ?>
  2888. <?php
  2889.    }
  2890.    else
  2891.    {
  2892. ?>
  2893.        <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.form_cancel.submit();""document.form_cancel.submit();""sc_b_cancel_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2894. ?>
  2895. <?php
  2896.    }
  2897. ?>
  2898.     </td>
  2899.     <td class="scFilterToolbarPadding" align="right" width="33%" nowrap>
  2900.     </td>
  2901.    </tr></table>
  2902. <?php
  2903.    if ($this->nmgp_botoes['save'] == "on")
  2904.    {
  2905. ?>
  2906.     </TD></TR><TR><TD>
  2907.     <DIV id="Salvar_filters_bot" style="display:none;z-index:9999;">
  2908.      <TABLE align="center" class="scFilterTable">
  2909.       <TR>
  2910.        <TD class="scFilterBlock">
  2911.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2912.          <tr>
  2913.           <td style="padding: 0px" valign="top" class="scFilterBlockFont"><?php echo $this->Ini->Nm_lang['lang_othr_srch_head'?></td>
  2914.           <td style="padding: 0px" align="right" valign="top">
  2915.            <?php echo nmButtonOutput($this->arr_buttons"bcancelar_appdiv""document.getElementById('Salvar_filters_bot').style.display = 'none';""document.getElementById('Salvar_filters_bot').style.display = 'none';""Cancel_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2916. ?>
  2917.           </td>
  2918.          </tr>
  2919.         </table>
  2920.        </TD>
  2921.       </TR>
  2922.       <TR>
  2923.        <TD class="scFilterFieldOdd">
  2924.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2925.          <tr>
  2926.           <td style="padding: 0px" valign="top">
  2927.            <input class="scFilterObjectOdd" type="text" id="SC_nmgp_save_name_bot" name="nmgp_save_name_bot" value="">
  2928.           </td>
  2929.           <td style="padding: 0px" align="right" valign="top">
  2930.            <?php echo nmButtonOutput($this->arr_buttons"bsalvar_appdiv""nm_save_form('bot');""nm_save_form('bot');""Save_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2931. ?>
  2932.           </td>
  2933.          </tr>
  2934.         </table>
  2935.        </TD>
  2936.       </TR>
  2937.       <TR>
  2938.        <TD class="scFilterFieldEven">
  2939.        <DIV id="Apaga_filters_bot" style="display:''">
  2940.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2941.          <tr>
  2942.           <td style="padding: 0px" valign="top">
  2943.           <div id="idAjaxSelect_NM_filters_del_bot">
  2944.            <SELECT class="scFilterObjectOdd" id="sel_filters_del_bot" name="NM_filters_del_bot" size="1">
  2945.             <option value=""></option>
  2946. <?php
  2947.           $Nome_filter "";
  2948.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  2949.           {
  2950.               $Select "";
  2951.               if ($Cada_filter == $this->NM_curr_fil)
  2952.               {
  2953.                   $Select "selected";
  2954.               }
  2955.               if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  2956.               {
  2957.                   $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  2958.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  2959.               }
  2960.               elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  2961.               {
  2962.                   $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  2963.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  2964.               }
  2965.               if ($Tipo_filter[1] != $Nome_filter)
  2966.               {
  2967.                   $Nome_filter $Tipo_filter[1];
  2968.                   echo "            <option value=\"\">" NM_encode_input($Nome_filter) . "</option>\r\n";
  2969.               }
  2970. ?>
  2971.             <option value="<?php echo NM_encode_input($Tipo_filter[0]) . "\" " $Select ">.." $Cada_filter ?></option>
  2972. <?php
  2973.           }
  2974. ?>
  2975.            </SELECT>
  2976.           </div>
  2977.           </td>
  2978.           <td style="padding: 0px" align="right" valign="top">
  2979.            <?php echo nmButtonOutput($this->arr_buttons"bexcluir_appdiv""nm_submit_filter_del('bot');""nm_submit_filter_del('bot');""Exc_filtro_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2980. ?>
  2981.           </td>
  2982.          </tr>
  2983.         </table>
  2984.        </DIV>
  2985.        </TD>
  2986.       </TR>
  2987.      </TABLE>
  2988.     </DIV> 
  2989. <?php
  2990.    }
  2991. ?>
  2992.   </TD>
  2993.  </TR>
  2994.      <?php
  2995.      }
  2996.  ?>
  2997. <?php
  2998.    }

  2999.    function monta_html_fim()
  3000.    {
  3001.        global $bprocessa$nm_url_saida$Script_BI;
  3002. ?>

  3003. </TABLE>
  3004.    <INPUT type="hidden" name="form_condicao" value="3">
  3005. </FORM> 
  3006. <?php
  3007.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start'] == 'filter')
  3008.    {
  3009. ?>
  3010.    <FORM style="display:none;" name="form_cancel"  method="POST" action="<?php echo $nm_url_saida?>" target="_self"> 
  3011. <?php
  3012.    }
  3013.    else
  3014.    {
  3015. ?>
  3016.    <FORM style="display:none;" name="form_cancel"  method="POST" action="./" target="_self"> 
  3017. <?php
  3018.    }
  3019. ?>
  3020.    <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  3021.    <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  3022. <?php
  3023.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq'] == "grid")
  3024.    {
  3025.        $Ret_cancel_pesq "volta_grid";
  3026.    }
  3027.    else
  3028.    {
  3029.        $Ret_cancel_pesq "resumo";
  3030.    }
  3031. ?>
  3032.    <INPUT type="hidden" name="nmgp_opcao" value="<?php echo $Ret_cancel_pesq?>"> 
  3033.    </FORM> 
  3034. <SCRIPT type="text/javascript">
  3035. <?php
  3036.    if (empty($this->NM_fil_ant))
  3037.    {
  3038.        if ($_SESSION['scriptcase']['proc_mobile'])
  3039.        {
  3040. ?>
  3041.       document.getElementById('Apaga_filters_bot').style.display = 'none';
  3042.       document.getElementById('sel_recup_filters_bot').style.display = 'none';
  3043. <?php
  3044.        }
  3045.        else
  3046.        {
  3047. ?>
  3048.       document.getElementById('Apaga_filters_bot').style.display = 'none';
  3049.       document.getElementById('sel_recup_filters_bot').style.display = 'none';
  3050. <?php
  3051.        }
  3052.    }
  3053. ?>
  3054.  function nm_move()
  3055.  {
  3056.      document.form_cancel.target = "_self"; 
  3057.      document.form_cancel.action = "./"; 
  3058.      document.form_cancel.submit(); 
  3059.  }
  3060.  function nm_submit_form()
  3061.  {
  3062.     document.F1.submit();
  3063.  }
  3064.  function limpa_form()
  3065.  {
  3066.    document.F1.reset();
  3067.    if (document.F1.NM_filters)
  3068.    {
  3069.        document.F1.NM_filters.selectedIndex = -1;
  3070.    }
  3071.    document.getElementById('Salvar_filters_bot').style.display = 'none';
  3072.    document.F1.proprietarios_idproprietario_cond.value = 'gt';
  3073.    nm_campos_between(document.getElementById('id_vis_proprietarios_idproprietario'), document.F1.proprietarios_idproprietario_cond, 'proprietarios_idproprietario');
  3074.    document.F1.proprietarios_idproprietario.value = "";
  3075.    document.F1.proprietarios_nome_cond.value = 'qp';
  3076.    nm_campos_between(document.getElementById('id_vis_proprietarios_nome'), document.F1.proprietarios_nome_cond, 'proprietarios_nome');
  3077.    document.F1.proprietarios_nome.value = "";
  3078.    document.F1.proprietarios_nome_autocomp.value = "";
  3079.    document.F1.proprietarios_sexo_cond.value = 'qp';
  3080.    nm_campos_between(document.getElementById('id_vis_proprietarios_sexo'), document.F1.proprietarios_sexo_cond, 'proprietarios_sexo');
  3081.    document.F1.proprietarios_sexo.value = "";
  3082.    document.F1.proprietarios_sexo_autocomp.value = "";
  3083.    document.F1.proprietarios_cpf_cond.value = 'gt';
  3084.    nm_campos_between(document.getElementById('id_vis_proprietarios_cpf'), document.F1.proprietarios_cpf_cond, 'proprietarios_cpf');
  3085.    document.F1.proprietarios_cpf.value = "";
  3086.  }
  3087.  function SC_carga_evt_jquery()
  3088.  {
  3089.  }
  3090.    function process_hotkeys(hotkey)
  3091.    {
  3092.       if (hotkey == 'sys_format_fi2') { 
  3093.          var output =  $('#sc_b_pesq_bot').click();
  3094.          return (0 < output.length);
  3095.       }
  3096.       if (hotkey == 'sys_format_lim') { 
  3097.          var output =  $('#limpa_frm_bot').click();
  3098.          return (0 < output.length);
  3099.       }
  3100.       if (hotkey == 'sys_format_edi') { 
  3101.          var output =  $('#Ativa_save_bot').click();
  3102.          return (0 < output.length);
  3103.       }
  3104.       if (hotkey == 'sys_format_webh') { 
  3105.          var output =  $('#sc_b_help_bot').click();
  3106.          return (0 < output.length);
  3107.       }
  3108.       if (hotkey == 'sys_format_sai') { 
  3109.          var output =  $('#sc_b_cancel_bot').click();
  3110.          return (0 < output.length);
  3111.       }
  3112.    return false;
  3113.    }
  3114. </SCRIPT>
  3115. </BODY>
  3116. </HTML>
  3117. <?php
  3118.    }

  3119.    function gera_array_filtros()
  3120.    {
  3121.        $this->NM_fil_ant = array();
  3122.        $NM_patch   "Projeto7/grid_new";
  3123.        if (is_dir($this->NM_path_filter $NM_patch))
  3124.        {
  3125.            $NM_dir = @opendir($this->NM_path_filter $NM_patch);
  3126.            while (FALSE !== ($NM_arq = @readdir($NM_dir)))
  3127.            {
  3128.              if (@is_file($this->NM_path_filter $NM_patch "/" $NM_arq))
  3129.              {
  3130.                  $Sc_v6 false;
  3131.                  $NMcmp_filter file($this->NM_path_filter $NM_patch "/" $NM_arq);
  3132.                  $NMcmp_filter explode("@NMF@"$NMcmp_filter[0]);
  3133.                  if (substr($NMcmp_filter[0], 06) == "SC_V6_" || substr($NMcmp_filter[0], 06) == "SC_V8_")
  3134.                  {
  3135.                      $Name_filter substr($NMcmp_filter[0], 6);
  3136.                      if (!empty($Name_filter))
  3137.                      {
  3138.                          $nmgp_save_name str_replace('/'' '$Name_filter);
  3139.                          $nmgp_save_name str_replace('\\'' '$nmgp_save_name);
  3140.                          $nmgp_save_name str_replace('.'' '$nmgp_save_name);
  3141.                          $this->NM_fil_ant[$Name_filter][0] = $NM_patch "/" $nmgp_save_name;
  3142.                          $this->NM_fil_ant[$Name_filter][1] = "" $this->Ini->Nm_lang['lang_srch_public'] . "";
  3143.                          $Sc_v6 true;
  3144.                      }
  3145.                  }
  3146.                  if (!$Sc_v6)
  3147.                  {
  3148.                      $this->NM_fil_ant[$NM_arq][0] = $NM_patch "/" $NM_arq;
  3149.                      $this->NM_fil_ant[$NM_arq][1] = "" $this->Ini->Nm_lang['lang_srch_public'] . "";
  3150.                  }
  3151.              }
  3152.            }
  3153.        }
  3154.        return $this->NM_fil_ant;
  3155.    }
  3156.    /**
  3157.     * @access  public
  3158.     * @param  string  $NM_operador  $this->Ini->Nm_lang['pesq_global_NM_operador']
  3159.     * @param  array  $nmgp_tab_label  
  3160.     */
  3161.    function inicializa_vars()
  3162.    {
  3163.       global $NM_operador$nmgp_tab_label;

  3164.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/");  
  3165.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1);  
  3166.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz;
  3167.       $this->Campos_Mens_erro ""
  3168.       $this->nm_data = new nm_data("en_us");
  3169.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] = "";
  3170.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  3171.       {
  3172.           $nmgp_tab_label $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'];
  3173.       }
  3174.       if (!empty($nmgp_tab_label))
  3175.       {
  3176.          $nm_tab_campos explode("?@?"$nmgp_tab_label);
  3177.          $nmgp_tab_label = array();
  3178.          foreach ($nm_tab_campos as $cada_campo)
  3179.          {
  3180.              $parte_campo explode("?#?"$cada_campo);
  3181.              $nmgp_tab_label[$parte_campo[0]] = $parte_campo[1];
  3182.          }
  3183.       }
  3184.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig']))
  3185.       {
  3186.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'] = "";
  3187.       }
  3188.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  3189.       {
  3190.           $this->comando "";
  3191.       }
  3192.       else
  3193.       {
  3194.           $this->comando $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  3195.       }
  3196.       $this->comando_sum    "";
  3197.       $this->comando_filtro "";
  3198.       $this->comando_ini    "ini";
  3199.       $this->comando_fim    "";
  3200.       $this->NM_operador    = (isset($NM_operador) && ("and" == strtolower($NM_operador) || "or" == strtolower($NM_operador))) ? $NM_operador "and";
  3201.    }

  3202.    function salva_filtro($nmgp_save_origem)
  3203.    {
  3204.       global $NM_filters_save$nmgp_save_name$nmgp_save_option$script_case_init;
  3205.           $NM_filters_save str_replace("__NM_PLUS__""+"$NM_filters_save);
  3206.           $NM_str_filter  "SC_V8_" $nmgp_save_name "@NMF@";
  3207.           $nmgp_save_name str_replace('/'' '$nmgp_save_name);
  3208.           $nmgp_save_name str_replace('\\'' '$nmgp_save_name);
  3209.           $nmgp_save_name str_replace('.'' '$nmgp_save_name);
  3210.           if (!NM_is_utf8($nmgp_save_name))
  3211.           {
  3212.               $nmgp_save_name sc_convert_encoding($nmgp_save_name"UTF-8"$_SESSION['scriptcase']['charset']);
  3213.           }
  3214.           $NM_str_filter  .= $NM_filters_save;
  3215.           $NM_patch $this->NM_path_filter;
  3216.           if (!is_dir($NM_patch))
  3217.           {
  3218.               $NMdir mkdir($NM_patch0755);
  3219.           }
  3220.           $NM_patch .= "Projeto7/";
  3221.           if (!is_dir($NM_patch))
  3222.           {
  3223.               $NMdir mkdir($NM_patch0755);
  3224.           }
  3225.           $NM_patch .= "grid_new/";
  3226.           if (!is_dir($NM_patch))
  3227.           {
  3228.               $NMdir mkdir($NM_patch0755);
  3229.           }
  3230.           $Parms_usr  "";
  3231.           $NM_filter fopen ($NM_patch $nmgp_save_name'w');
  3232.           if (!NM_is_utf8($NM_str_filter))
  3233.           {
  3234.               $NM_str_filter sc_convert_encoding($NM_str_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  3235.           }
  3236.           fwrite($NM_filter$NM_str_filter);
  3237.           fclose($NM_filter);
  3238.    }
  3239.    function recupera_filtro($NM_filters)
  3240.    {
  3241.       global $NM_operador$script_case_init;
  3242.       $NM_patch $this->NM_path_filter "/" $NM_filters;
  3243.       if (!is_file($NM_patch))
  3244.       {
  3245.           $NM_filters sc_convert_encoding($NM_filters"UTF-8"$_SESSION['scriptcase']['charset']);
  3246.           $NM_patch $this->NM_path_filter "/" $NM_filters;
  3247.       }
  3248.       $return_fields = array();
  3249.       $tp_fields     = array();
  3250.       $tb_fields_esp = array();
  3251.       $old_bi_opcs   = array("TP","HJ","OT","U7","SP","US","MM","UM","AM","PS","SS","P3","PM","P7","CY","LY","YY","M6","M3","M18","M24");
  3252.       $tp_fields['SC_proprietarios_idproprietario_cond'] = 'cond';
  3253.       $tp_fields['SC_proprietarios_idproprietario'] = 'text';
  3254.       $tp_fields['SC_proprietarios_nome_cond'] = 'cond';
  3255.       $tp_fields['SC_proprietarios_nome'] = 'text_aut';
  3256.       $tp_fields['id_ac_proprietarios_nome'] = 'text_aut';
  3257.       $tp_fields['SC_proprietarios_sexo_cond'] = 'cond';
  3258.       $tp_fields['SC_proprietarios_sexo'] = 'text_aut';
  3259.       $tp_fields['id_ac_proprietarios_sexo'] = 'text_aut';
  3260.       $tp_fields['SC_proprietarios_cpf_cond'] = 'cond';
  3261.       $tp_fields['SC_proprietarios_cpf'] = 'text';
  3262.       $tp_fields['SC_NM_operador'] = 'text';
  3263.       if (is_file($NM_patch))
  3264.       {
  3265.           $SC_V8    false;
  3266.           $NMfilter file($NM_patch);
  3267.           $NMcmp_filter explode("@NMF@"$NMfilter[0]);
  3268.           if (substr($NMcmp_filter[0], 05) == "SC_V8")
  3269.           {
  3270.               $SC_V8 true;
  3271.           }
  3272.           if (substr($NMcmp_filter[0], 05) == "SC_V6" || substr($NMcmp_filter[0], 05) == "SC_V8")
  3273.           {
  3274.               unset($NMcmp_filter[0]);
  3275.           }
  3276.           foreach ($NMcmp_filter as $Cada_cmp)
  3277.           {
  3278.               $Cada_cmp explode("#NMF#"$Cada_cmp);
  3279.               if (isset($tb_fields_esp[$Cada_cmp[0]]))
  3280.               {
  3281.                   $Cada_cmp[0] = $tb_fields_esp[$Cada_cmp[0]];
  3282.               }
  3283.               if (!$SC_V8 && substr($Cada_cmp[0], 011) != "div_ac_lab_" && substr($Cada_cmp[0], 06) != "id_ac_")
  3284.               {
  3285.                   $Cada_cmp[0] = "SC_" $Cada_cmp[0];
  3286.               }
  3287.               if (!isset($tp_fields[$Cada_cmp[0]]))
  3288.               {
  3289.                   continue;
  3290.               }
  3291.               $list   = array();
  3292.               $list_a = array();
  3293.               if (substr($Cada_cmp[1], 010) == "_NM_array_")
  3294.               {
  3295.                   if (substr($Cada_cmp[1], 017) == "_NM_array_#NMARR#")
  3296.                   {
  3297.                       $Sc_temp explode("#NMARR#"substr($Cada_cmp[1], 17));
  3298.                       foreach ($Sc_temp as $Cada_val)
  3299.                       {
  3300.                           $list[]   = $Cada_val;
  3301.                           $tmp_pos  strpos($Cada_val"##@@");
  3302.                           $val_a    = ($tmp_pos !== false) ?  substr($Cada_val$tmp_pos 4) : $Cada_val;
  3303.                           $list_a[] = array('opt' => $Cada_val'value' => $val_a);
  3304.                       }
  3305.                   }
  3306.               }
  3307.               elseif ($tp_fields[$Cada_cmp[0]] == 'dselect')
  3308.               {
  3309.                   $list[]   = $Cada_cmp[1];
  3310.                   $tmp_pos  strpos($Cada_cmp[1], "##@@");
  3311.                   $val_a    = ($tmp_pos !== false) ?  substr($Cada_cmp[1], $tmp_pos 4) : $Cada_cmp[1];
  3312.                   $list_a[] = array('opt' => $Cada_cmp[1], 'value' => $val_a);
  3313.               }
  3314.               else
  3315.               {
  3316.                   $list[0] = $Cada_cmp[1];
  3317.               }
  3318.               if ($tp_fields[$Cada_cmp[0]] == 'select2_aut')
  3319.               {
  3320.                   if (!isset($list[0]))
  3321.                   {
  3322.                       $list[0] = "";
  3323.                   }
  3324.                   $return_fields['set_select2_aut'][] = array('field' => $Cada_cmp[0], 'value' => $list[0]);
  3325.               }
  3326.               elseif ($tp_fields[$Cada_cmp[0]] == 'dselect')
  3327.               {
  3328.                   $return_fields['set_dselect'][] = array('field' => $Cada_cmp[0], 'value' => $list_a);
  3329.               }
  3330.               elseif ($tp_fields[$Cada_cmp[0]] == 'fil_order')
  3331.               {
  3332.                   $return_fields['set_fil_order'][] = array('field' => $Cada_cmp[0], 'value' => $list);
  3333.               }
  3334.               elseif ($tp_fields[$Cada_cmp[0]] == 'selmult')
  3335.               {
  3336.                   if (count($list) == && $list[0] == "")
  3337.                   {
  3338.                       continue;
  3339.                   }
  3340.                   $return_fields['set_selmult'][] = array('field' => $Cada_cmp[0], 'value' => $list);
  3341.               }
  3342.               elseif ($tp_fields[$Cada_cmp[0]] == 'ddcheckbox')
  3343.               {
  3344.                   $return_fields['set_ddcheckbox'][] = array('field' => $Cada_cmp[0], 'value' => $list);
  3345.               }
  3346.               elseif ($tp_fields[$Cada_cmp[0]] == 'checkbox')
  3347.               {
  3348.                   $return_fields['set_checkbox'][] = array('field' => $Cada_cmp[0], 'value' => $list);
  3349.               }
  3350.               else
  3351.               {
  3352.                   if (!isset($list[0]))
  3353.                   {
  3354.                       $list[0] = "";
  3355.                   }
  3356.                   if ($tp_fields[$Cada_cmp[0]] == 'html')
  3357.                   {
  3358.                       $return_fields['set_html'][] = array('field' => $Cada_cmp[0], 'value' => $list[0]);
  3359.                   }
  3360.                   elseif ($tp_fields[$Cada_cmp[0]] == 'radio')
  3361.                   {
  3362.                       $return_fields['set_radio'][] = array('field' => $Cada_cmp[0], 'value' => $list[0]);
  3363.                   }
  3364.                   elseif ($tp_fields[$Cada_cmp[0]] == 'cond' && in_array($list[0], $old_bi_opcs))
  3365.                   {
  3366.                       $Cada_cmp[1] = "bi_" $list[0];
  3367.                       $return_fields['set_val'][] = array('field' => $Cada_cmp[0], 'value' => $Cada_cmp[1]);
  3368.                   }
  3369.                   else
  3370.                   {
  3371.                       $return_fields['set_val'][] = array('field' => $Cada_cmp[0], 'value' => $list[0]);
  3372.                   }
  3373.               }
  3374.           }
  3375.           $this->NM_curr_fil $NM_filters;
  3376.       }
  3377.       return $return_fields;
  3378.    }
  3379.    function apaga_filtro()
  3380.    {
  3381.       global $NM_filters_del;
  3382.       if (isset($NM_filters_del) && !empty($NM_filters_del))
  3383.       { 
  3384.           $NM_patch $this->NM_path_filter "/" $NM_filters_del;
  3385.           if (!is_file($NM_patch))
  3386.           {
  3387.               $NM_filters_del sc_convert_encoding($NM_filters_del"UTF-8"$_SESSION['scriptcase']['charset']);
  3388.               $NM_patch $this->NM_path_filter "/" $NM_filters_del;
  3389.           }
  3390.           if (is_file($NM_patch))
  3391.           {
  3392.               @unlink($NM_patch);
  3393.           }
  3394.           if ($NM_filters_del == $this->NM_curr_fil)
  3395.           {
  3396.               $this->NM_curr_fil "";
  3397.           }
  3398.       }
  3399.    }
  3400.    /**
  3401.     * @access  public
  3402.     */
  3403.    function trata_campos()
  3404.    {
  3405.       global $proprietarios_idproprietario_cond$proprietarios_idproprietario,
  3406.              $proprietarios_nome_cond$proprietarios_nome$proprietarios_nome_autocomp,
  3407.              $proprietarios_sexo_cond$proprietarios_sexo$proprietarios_sexo_autocomp,
  3408.              $proprietarios_cpf_cond$proprietarios_cpf$nmgp_tab_label;

  3409.       $C_formatado true;
  3410.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  3411.       {
  3412.           if ($this->NM_ajax_opcao == "ajax_grid_search")
  3413.           {
  3414.               $C_formatado false;
  3415.           }
  3416.           $Temp_Busca  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'];
  3417.           if ($_SESSION['scriptcase']['charset'] != "UTF-8" && $this->NM_ajax_opcao != "ajax_grid_search_change_fil")
  3418.           {
  3419.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = NM_conv_charset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'], $_SESSION['scriptcase']['charset'], "UTF-8");
  3420.           }
  3421.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] as $Cmps => $Vals)
  3422.           {
  3423.               $$Cmps $Vals;
  3424.           }
  3425.       }
  3426.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_gp_limpa.php""F""nm_limpa_valor") ; 
  3427.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_conv_dados.php""F""nm_conv_limpa_dado") ; 
  3428.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_edit.php""F""nmgp_Form_Num_Val") ; 
  3429.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'] = array();
  3430.       if (!empty($proprietarios_nome_autocomp) && empty($proprietarios_nome))
  3431.       {
  3432.           $proprietarios_nome $proprietarios_nome_autocomp;
  3433.       }
  3434.       if (!empty($proprietarios_sexo_autocomp) && empty($proprietarios_sexo))
  3435.       {
  3436.           $proprietarios_sexo $proprietarios_sexo_autocomp;
  3437.       }
  3438.       $proprietarios_idproprietario_cond_salva $proprietarios_idproprietario_cond
  3439.       if (!isset($proprietarios_idproprietario_input_2) || $proprietarios_idproprietario_input_2 == "")
  3440.       {
  3441.           $proprietarios_idproprietario_input_2 $proprietarios_idproprietario;
  3442.       }
  3443.       $proprietarios_nome_cond_salva $proprietarios_nome_cond
  3444.       if (!isset($proprietarios_nome_input_2) || $proprietarios_nome_input_2 == "")
  3445.       {
  3446.           $proprietarios_nome_input_2 $proprietarios_nome;
  3447.       }
  3448.       $proprietarios_sexo_cond_salva $proprietarios_sexo_cond
  3449.       if (!isset($proprietarios_sexo_input_2) || $proprietarios_sexo_input_2 == "")
  3450.       {
  3451.           $proprietarios_sexo_input_2 $proprietarios_sexo;
  3452.       }
  3453.       $proprietarios_cpf_cond_salva $proprietarios_cpf_cond
  3454.       if (!isset($proprietarios_cpf_input_2) || $proprietarios_cpf_input_2 == "")
  3455.       {
  3456.           $proprietarios_cpf_input_2 $proprietarios_cpf;
  3457.       }
  3458.       if ($proprietarios_idproprietario_cond != "in")
  3459.       {
  3460.           nm_limpa_numero($proprietarios_idproprietario$_SESSION['scriptcase']['reg_conf']['grup_num']) ; 
  3461.       }
  3462.       else
  3463.       {
  3464.           $Nm_sc_valores explode(","$proprietarios_idproprietario);
  3465.           foreach ($Nm_sc_valores as $II => $Nm_sc_valor)
  3466.           {
  3467.               $Nm_sc_valor trim($Nm_sc_valor);
  3468.               nm_limpa_numero($Nm_sc_valor$_SESSION['scriptcase']['reg_conf']['grup_num']); 
  3469.               $Nm_sc_valores[$II] = $Nm_sc_valor;
  3470.           }
  3471.           $proprietarios_idproprietario implode(","$Nm_sc_valores);
  3472.       }
  3473.       if ($proprietarios_cpf_cond != "in")
  3474.       {
  3475.           nm_limpa_numero($proprietarios_cpf$_SESSION['scriptcase']['reg_conf']['grup_num']) ; 
  3476.       }
  3477.       else
  3478.       {
  3479.           $Nm_sc_valores explode(","$proprietarios_cpf);
  3480.           foreach ($Nm_sc_valores as $II => $Nm_sc_valor)
  3481.           {
  3482.               $Nm_sc_valor trim($Nm_sc_valor);
  3483.               nm_limpa_numero($Nm_sc_valor$_SESSION['scriptcase']['reg_conf']['grup_num']); 
  3484.               $Nm_sc_valores[$II] = $Nm_sc_valor;
  3485.           }
  3486.           $proprietarios_cpf implode(","$Nm_sc_valores);
  3487.       }
  3488.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']  = array(); 
  3489.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search']  = array(); 
  3490.       $I_Grid 0;
  3491.       $Dyn_ok false;
  3492.       $Grid_ok false;
  3493.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_idproprietario'] = $proprietarios_idproprietario
  3494.       if (is_array($proprietarios_idproprietario) && !empty($proprietarios_idproprietario))
  3495.       {
  3496.           $Grid_ok true;
  3497.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0] = $proprietarios_idproprietario;
  3498.       }
  3499.       elseif ($proprietarios_idproprietario_cond_salva == "nu" || $proprietarios_idproprietario_cond_salva == "nn" || $proprietarios_idproprietario_cond_salva == "ep" || $proprietarios_idproprietario_cond_salva == "ne" ||  !empty($proprietarios_idproprietario))
  3500.       {
  3501.           $Grid_ok true;
  3502.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0][0] = $proprietarios_idproprietario;
  3503.       }
  3504.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_idproprietario_cond'] = $proprietarios_idproprietario_cond_salva
  3505.       if ($Grid_ok)
  3506.       {
  3507.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['cmp'] = "proprietarios_idproprietario"
  3508.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['opc'] = $proprietarios_idproprietario_cond_salva
  3509.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']['proprietarios_idproprietario'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid];
  3510.           $I_Grid++;
  3511.       }
  3512.       $Dyn_ok false;
  3513.       $Grid_ok false;
  3514.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_nome'] = $proprietarios_nome
  3515.       if (is_array($proprietarios_nome) && !empty($proprietarios_nome))
  3516.       {
  3517.           $Grid_ok true;
  3518.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0] = $proprietarios_nome;
  3519.       }
  3520.       elseif ($proprietarios_nome_cond_salva == "nu" || $proprietarios_nome_cond_salva == "nn" || $proprietarios_nome_cond_salva == "ep" || $proprietarios_nome_cond_salva == "ne" ||  !empty($proprietarios_nome))
  3521.       {
  3522.           $Grid_ok true;
  3523.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0][0] = $proprietarios_nome;
  3524.       }
  3525.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_nome_cond'] = $proprietarios_nome_cond_salva
  3526.       if ($Grid_ok)
  3527.       {
  3528.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['cmp'] = "proprietarios_nome"
  3529.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['opc'] = $proprietarios_nome_cond_salva
  3530.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']['proprietarios_nome'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid];
  3531.           $I_Grid++;
  3532.       }
  3533.       $Dyn_ok false;
  3534.       $Grid_ok false;
  3535.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_sexo'] = $proprietarios_sexo
  3536.       if (is_array($proprietarios_sexo) && !empty($proprietarios_sexo))
  3537.       {
  3538.           $Grid_ok true;
  3539.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0] = $proprietarios_sexo;
  3540.       }
  3541.       elseif ($proprietarios_sexo_cond_salva == "nu" || $proprietarios_sexo_cond_salva == "nn" || $proprietarios_sexo_cond_salva == "ep" || $proprietarios_sexo_cond_salva == "ne" ||  !empty($proprietarios_sexo))
  3542.       {
  3543.           $Grid_ok true;
  3544.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0][0] = $proprietarios_sexo;
  3545.       }
  3546.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_sexo_cond'] = $proprietarios_sexo_cond_salva
  3547.       if ($Grid_ok)
  3548.       {
  3549.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['cmp'] = "proprietarios_sexo"
  3550.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['opc'] = $proprietarios_sexo_cond_salva
  3551.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']['proprietarios_sexo'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid];
  3552.           $I_Grid++;
  3553.       }
  3554.       $Dyn_ok false;
  3555.       $Grid_ok false;
  3556.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_cpf'] = $proprietarios_cpf
  3557.       if (is_array($proprietarios_cpf) && !empty($proprietarios_cpf))
  3558.       {
  3559.           $Grid_ok true;
  3560.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0] = $proprietarios_cpf;
  3561.       }
  3562.       elseif ($proprietarios_cpf_cond_salva == "nu" || $proprietarios_cpf_cond_salva == "nn" || $proprietarios_cpf_cond_salva == "ep" || $proprietarios_cpf_cond_salva == "ne" ||  !empty($proprietarios_cpf))
  3563.       {
  3564.           $Grid_ok true;
  3565.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0][0] = $proprietarios_cpf;
  3566.       }
  3567.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_cpf_cond'] = $proprietarios_cpf_cond_salva
  3568.       if ($Grid_ok)
  3569.       {
  3570.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['cmp'] = "proprietarios_cpf"
  3571.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['opc'] = $proprietarios_cpf_cond_salva
  3572.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']['proprietarios_cpf'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid];
  3573.           $I_Grid++;
  3574.       }
  3575.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['NM_operador'] = $this->NM_operador
  3576.       if ($this->NM_ajax_flag && $this->NM_ajax_opcao == "ajax_grid_search")
  3577.       {
  3578.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = $Temp_Busca;
  3579.       }
  3580.       if (!empty($this->Campos_Mens_erro)) 
  3581.       {
  3582.           return;
  3583.       }
  3584.       $Conteudo $proprietarios_idproprietario;
  3585.       if (strtoupper($proprietarios_idproprietario_cond) != "II" && strtoupper($proprietarios_idproprietario_cond) != "QP" && strtoupper($proprietarios_idproprietario_cond) != "NP" && strtoupper($proprietarios_idproprietario_cond) != "IN"
  3586.       { 
  3587.           nmgp_Form_Num_Val($Conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  3588.       } 
  3589.       $this->cmp_formatado['proprietarios_idproprietario'] = $Conteudo;
  3590.       $proprietarios_nome_look substr($this->Db->qstr($proprietarios_nome), 1, -1); 
  3591.       $nmgp_def_dados = array(); 
  3592.       $nm_comando "select distinct Proprietarios.Nome from " $this->Ini->nm_tabela " where Proprietarios.Nome = '$proprietarios_nome_look' order by Proprietarios.Nome"
  3593.       unset($cmp1,$cmp2);
  3594.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  3595.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  3596.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  3597.       { 
  3598.          while (!$rs->EOF
  3599.          { 
  3600.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  3601.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  3602.             $rs->MoveNext() ; 
  3603.          } 
  3604.          $rs->Close() ; 
  3605.       } 
  3606.       else  
  3607.       {  
  3608.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  3609.          exit; 
  3610.       } 

  3611.       if (!empty($nmgp_def_dados) && isset($cmp2) && !empty($cmp2))
  3612.       {
  3613.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  3614.           {
  3615.              $cmp2 NM_conv_charset($cmp2$_SESSION['scriptcase']['charset'], "UTF-8");
  3616.           }
  3617.           $this->cmp_formatado['proprietarios_nome'] = $cmp2;
  3618.       }
  3619.       elseif (!empty($nmgp_def_dados) && isset($cmp1) && !empty($cmp1))
  3620.       {
  3621.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  3622.           {
  3623.              $cmp1 NM_conv_charset($cmp1$_SESSION['scriptcase']['charset'], "UTF-8");
  3624.           }
  3625.           $this->cmp_formatado['proprietarios_nome'] = $cmp1;
  3626.       }
  3627.       else
  3628.       {
  3629.           $this->cmp_formatado['proprietarios_nome'] = $proprietarios_nome;
  3630.       }
  3631.       $proprietarios_sexo_look substr($this->Db->qstr($proprietarios_sexo), 1, -1); 
  3632.       $nmgp_def_dados = array(); 
  3633.       $nm_comando "select distinct Proprietarios.Sexo from " $this->Ini->nm_tabela " where Proprietarios.Sexo = '$proprietarios_sexo_look' order by Proprietarios.Sexo"
  3634.       unset($cmp1,$cmp2);
  3635.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  3636.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  3637.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  3638.       { 
  3639.          while (!$rs->EOF
  3640.          { 
  3641.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  3642.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  3643.             $rs->MoveNext() ; 
  3644.          } 
  3645.          $rs->Close() ; 
  3646.       } 
  3647.       else  
  3648.       {  
  3649.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  3650.          exit; 
  3651.       } 

  3652.       if (!empty($nmgp_def_dados) && isset($cmp2) && !empty($cmp2))
  3653.       {
  3654.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  3655.           {
  3656.              $cmp2 NM_conv_charset($cmp2$_SESSION['scriptcase']['charset'], "UTF-8");
  3657.           }
  3658.           $this->cmp_formatado['proprietarios_sexo'] = $cmp2;
  3659.       }
  3660.       elseif (!empty($nmgp_def_dados) && isset($cmp1) && !empty($cmp1))
  3661.       {
  3662.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  3663.           {
  3664.              $cmp1 NM_conv_charset($cmp1$_SESSION['scriptcase']['charset'], "UTF-8");
  3665.           }
  3666.           $this->cmp_formatado['proprietarios_sexo'] = $cmp1;
  3667.       }
  3668.       else
  3669.       {
  3670.           $this->cmp_formatado['proprietarios_sexo'] = $proprietarios_sexo;
  3671.       }
  3672.       $Conteudo $proprietarios_cpf;
  3673.       if (strtoupper($proprietarios_cpf_cond) != "II" && strtoupper($proprietarios_cpf_cond) != "QP" && strtoupper($proprietarios_cpf_cond) != "NP" && strtoupper($proprietarios_cpf_cond) != "IN"
  3674.       { 
  3675.           nmgp_Form_Num_Val($Conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  3676.       } 
  3677.       $this->cmp_formatado['proprietarios_cpf'] = $Conteudo;

  3678.       //----- $proprietarios_idproprietario
  3679.       $this->Date_part false;
  3680.       if (isset($proprietarios_idproprietario) || $proprietarios_idproprietario_cond == "nu" || $proprietarios_idproprietario_cond == "nn" || $proprietarios_idproprietario_cond == "ep" || $proprietarios_idproprietario_cond == "ne")
  3681.       {
  3682.          $this->monta_condicao("Proprietarios.idProprietario"$proprietarios_idproprietario_cond$proprietarios_idproprietario"""proprietarios_idproprietario");
  3683.       }

  3684.       //----- $proprietarios_nome
  3685.       $this->Date_part false;
  3686.       if (isset($proprietarios_nome) || $proprietarios_nome_cond == "nu" || $proprietarios_nome_cond == "nn" || $proprietarios_nome_cond == "ep" || $proprietarios_nome_cond == "ne")
  3687.       {
  3688.          $this->monta_condicao("Proprietarios.Nome"$proprietarios_nome_cond$proprietarios_nome"""proprietarios_nome");
  3689.       }

  3690.       //----- $proprietarios_sexo
  3691.       $this->Date_part false;
  3692.       if (isset($proprietarios_sexo) || $proprietarios_sexo_cond == "nu" || $proprietarios_sexo_cond == "nn" || $proprietarios_sexo_cond == "ep" || $proprietarios_sexo_cond == "ne")
  3693.       {
  3694.          $this->monta_condicao("Proprietarios.Sexo"$proprietarios_sexo_cond$proprietarios_sexo"""proprietarios_sexo");
  3695.       }

  3696.       //----- $proprietarios_cpf
  3697.       $this->Date_part false;
  3698.       if (isset($proprietarios_cpf) || $proprietarios_cpf_cond == "nu" || $proprietarios_cpf_cond == "nn" || $proprietarios_cpf_cond == "ep" || $proprietarios_cpf_cond == "ne")
  3699.       {
  3700.          $this->monta_condicao("Proprietarios.Cpf"$proprietarios_cpf_cond$proprietarios_cpf"""proprietarios_cpf");
  3701.       }
  3702.    }

  3703.    /**
  3704.     * @access  public
  3705.     */
  3706.    function finaliza_resultado_ajax()
  3707.    {
  3708.        $this->comando substr($this->comando8);
  3709.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_grid'] = $this->comando;
  3710.        if (empty($this->comando)) 
  3711.        {
  3712.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = "";
  3713.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']        = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  3714.        }
  3715.        else
  3716.        {
  3717.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = "( " $this->comando " )";
  3718.            if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'])) 
  3719.            {
  3720.                $this->comando $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'] . " and (" $this->comando ")"
  3721.            }
  3722.            else
  3723.            {
  3724.                $this->comando " where " $this->comando
  3725.            }
  3726.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] = $this->comando;
  3727.        }
  3728.        if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'])) 
  3729.        {
  3730.            if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'])) 
  3731.            {
  3732.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] .= " and (" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'] . ")";
  3733.            }
  3734.            else 
  3735.            {
  3736.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] = " where (" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'] . ")";
  3737.            }
  3738.        }
  3739.    }
  3740.    function finaliza_resultado()
  3741.    {
  3742.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dyn_search']      = array();
  3743.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_dyn_search'] = "";
  3744.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'] = "";
  3745.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search']);
  3746.       if ("" == $this->comando_filtro)
  3747.       {
  3748.           $this->comando $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  3749.       }
  3750.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  3751.       {
  3752.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = NM_conv_charset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'], "UTF-8"$_SESSION['scriptcase']['charset']);
  3753.       }

  3754.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_grid']    = $this->comando_filtro;
  3755.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_lookup']  = $this->comando_sum $this->comando_fim;
  3756.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']         = $this->comando $this->comando_fim;
  3757.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']              = "pesq";
  3758.       if ("" == $this->comando_filtro)
  3759.       {
  3760.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = "";
  3761.       }
  3762.       else
  3763.       {
  3764.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = " (" $this->comando_filtro ")";
  3765.       }
  3766.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] != $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'])
  3767.       {
  3768.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $this->NM_operador;
  3769.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_array_resumo'] = "NAO";
  3770.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral']  = "NAO";
  3771.          unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral']);
  3772.       }
  3773.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];

  3774.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  3775.       {
  3776.          return;
  3777.       }
  3778.       $this->retorna_pesq();
  3779.    }
  3780.    function nm_gera_mask(&$nm_campo$nm_mask)
  3781.    { 
  3782.       $trab_campo $nm_campo;
  3783.       $trab_mask  $nm_mask;
  3784.       $tam_campo  strlen($nm_campo);
  3785.       $trab_saida "";
  3786.       $mask_num false;
  3787.       for ($x=0$x strlen($trab_mask); $x++)
  3788.       {
  3789.           if (substr($trab_mask$x1) == "#")
  3790.           {
  3791.               $mask_num true;
  3792.               break;
  3793.           }
  3794.       }
  3795.       if ($mask_num )
  3796.       {
  3797.           $ver_duas explode(";"$trab_mask);
  3798.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  3799.           {
  3800.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  3801.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  3802.               if ($cont2 >= $tam_campo)
  3803.               {
  3804.                   $trab_mask $ver_duas[1];
  3805.               }
  3806.               else
  3807.               {
  3808.                   $trab_mask $ver_duas[0];
  3809.               }
  3810.           }
  3811.           $tam_mask strlen($trab_mask);
  3812.           $xdados 0;
  3813.           for ($x=0$x $tam_mask$x++)
  3814.           {
  3815.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  3816.               {
  3817.                   $trab_saida .= substr($trab_campo$xdados1);
  3818.                   $xdados++;
  3819.               }
  3820.               elseif ($xdados $tam_campo)
  3821.               {
  3822.                   $trab_saida .= substr($trab_mask$x1);
  3823.               }
  3824.           }
  3825.           if ($xdados $tam_campo)
  3826.           {
  3827.               $trab_saida .= substr($trab_campo$xdados);
  3828.           }
  3829.           $nm_campo $trab_saida;
  3830.           return;
  3831.       }
  3832.       for ($ix strlen($trab_mask); $ix 0$ix--)
  3833.       {
  3834.            $char_mask substr($trab_mask$ix 11);
  3835.            if ($char_mask != "x" && $char_mask != "z")
  3836.            {
  3837.                $trab_saida $char_mask $trab_saida;
  3838.            }
  3839.            else
  3840.            {
  3841.                if ($tam_campo != 0)
  3842.                {
  3843.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  3844.                    $tam_campo--;
  3845.                }
  3846.                else
  3847.                {
  3848.                    $trab_saida "0" $trab_saida;
  3849.                }
  3850.            }
  3851.       }
  3852.       if ($tam_campo != 0)
  3853.       {
  3854.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  3855.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  3856.       }
  3857.    
  3858.       $iz 0
  3859.       for ($ix 0$ix strlen($trab_mask); $ix++)
  3860.       {
  3861.            $char_mask substr($trab_mask$ix1);
  3862.            if ($char_mask != "x" && $char_mask != "z")
  3863.            {
  3864.                if ($char_mask == "." || $char_mask == ",")
  3865.                {
  3866.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  3867.                }
  3868.                else
  3869.                {
  3870.                    $iz++;
  3871.                }
  3872.            }
  3873.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  3874.            {
  3875.                $ix strlen($trab_mask) + 1;
  3876.            }
  3877.            else
  3878.            {
  3879.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  3880.            }
  3881.       }
  3882.       $nm_campo $trab_saida;
  3883.    } 
  3884.    function nm_conv_data_db($dt_in$form_in$form_out)
  3885.    {
  3886.        $dt_out $dt_in;
  3887.        if (strtoupper($form_in) == "DB_FORMAT")
  3888.        {
  3889.            if ($dt_out == "null" || $dt_out == "")
  3890.            {
  3891.                $dt_out "";
  3892.                return $dt_out;
  3893.            }
  3894.            $form_in "AAAA-MM-DD";
  3895.        }
  3896.        if (strtoupper($form_out) == "DB_FORMAT")
  3897.        {
  3898.            if (empty($dt_out))
  3899.            {
  3900.                $dt_out "null";
  3901.                return $dt_out;
  3902.            }
  3903.            $form_out "AAAA-MM-DD";
  3904.        }
  3905.        nm_conv_form_data($dt_out$form_in$form_out);
  3906.        return $dt_out;
  3907.    }
  3908. }

  3909. ?>
Return
grid_new_order_campos.php
  1. <?php
  2.    include_once('grid_new_session.php');
  3.    session_start();
  4.    $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  5.    //check tmp
  6.    if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  7.    {
  8.        $str_path_apl_url $_SERVER['PHP_SELF'];
  9.        $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  10.        $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  11.        $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  12.        /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  13.    }
  14.    if (!isset($_SESSION['sc_session']))
  15.    {
  16.        $NM_dir_atual getcwd();
  17.        if (empty($NM_dir_atual))
  18.        {
  19.            $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  20.            $str_path_sys  str_replace("\\"'/'$str_path_sys);
  21.        }
  22.        else
  23.        {
  24.            $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  25.            $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  26.        }
  27.        $str_path_web    $_SERVER['PHP_SELF'];
  28.        $str_path_web    str_replace("\\"'/'$str_path_web);
  29.        $str_path_web    str_replace('//''/'$str_path_web);
  30.        $root            substr($str_path_sys0, -strlen($str_path_web));
  31.        if (is_file($root $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/sc_apl_default_Projeto7.txt"))
  32.        {
  33. ?>
  34.            <script language="javascript">
  35.             nm_move();
  36.            </script>
  37. <?php
  38.            exit;
  39.        }
  40.    }
  41.    if (!function_exists("NM_is_utf8"))
  42.    {
  43.        include_once("../_lib/lib/php/nm_utf8.php");
  44.    }
  45.    $Ord_Cmp = new grid_new_Ord_cmp(); 
  46.    $Ord_Cmp->Ord_cmp_init();
  47.    
  48. class grid_new_Ord_cmp
  49. {
  50. function Ord_cmp_init()
  51. {
  52.   global $sc_init$path_img$path_btn$use_alias$tab_ger_campos$tab_def_campos$tab_def_seq$tab_labels$embbed$tbar_pos$_POST$_GET;
  53.    if (isset($_POST['script_case_init']))
  54.    {
  55.        $sc_init    filter_input(INPUT_POST'script_case_init'FILTER_SANITIZE_NUMBER_INT);
  56.        $path_img   filter_input(INPUT_POST'path_img'FILTER_SANITIZE_STRING);
  57.        $path_btn   filter_input(INPUT_POST'path_btn'FILTER_SANITIZE_STRING);
  58.        $use_alias  = (isset($_POST['use_alias']))  ? filter_input(INPUT_POST'use_alias'FILTER_SANITIZE_STRING)  : "S";
  59.        $fsel_ok    filter_input(INPUT_POST'fsel_ok'FILTER_SANITIZE_STRING);
  60.        $campos_sel filter_input(INPUT_POST'campos_sel'FILTER_SANITIZE_STRING);
  61.        $sel_regra  filter_input(INPUT_POST'sel_regra'FILTER_SANITIZE_STRING);
  62.        $embbed     = isset($_POST['embbed_groupby']) && 'Y' == $_POST['embbed_groupby'];
  63.        $tbar_pos   filter_input(INPUT_POST'toolbar_pos'FILTER_SANITIZE_SPECIAL_CHARS);
  64.    }
  65.    elseif (isset($_GET['script_case_init']))
  66.    {
  67.        $sc_init    filter_input(INPUT_GET'script_case_init'FILTER_SANITIZE_NUMBER_INT);
  68.        $path_img   filter_input(INPUT_GET'path_img'FILTER_SANITIZE_STRING);
  69.        $path_btn   filter_input(INPUT_GET'path_btn'FILTER_SANITIZE_STRING);
  70.        $use_alias  = (isset($_GET['use_alias']))  ? filter_input(INPUT_GET'use_alias'FILTER_SANITIZE_STRING)  : "S";
  71.        $fsel_ok    filter_input(INPUT_GET'fsel_ok'FILTER_SANITIZE_STRING);
  72.        $campos_sel filter_input(INPUT_GET'campos_sel'FILTER_SANITIZE_STRING);
  73.        $sel_regra  filter_input(INPUT_GET'sel_regra'FILTER_SANITIZE_STRING);
  74.        $embbed     = isset($_GET['embbed_groupby']) && 'Y' == $_GET['embbed_groupby'];
  75.        $tbar_pos   filter_input(INPUT_GET'toolbar_pos'FILTER_SANITIZE_SPECIAL_CHARS);
  76.    }
  77.    $STR_lang    = (isset($_SESSION['scriptcase']['str_lang']) && !empty($_SESSION['scriptcase']['str_lang'])) ? $_SESSION['scriptcase']['str_lang'] : "en_us";
  78.    $NM_arq_lang "../_lib/lang/" $STR_lang ".lang.php";
  79.    $this->Nm_lang = array();
  80.    if (is_file($NM_arq_lang))
  81.    {
  82.        include_once($NM_arq_lang);
  83.    }
  84.    if (!isset($_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select_orig']))
  85.    {
  86.        $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select_orig'] = array();
  87.    }
  88.    $this->restore = isset($_POST['restore']) ? true false;
  89.    if ($this->restore && !class_exists('Services_JSON')) {
  90.        include_once("grid_new_json.php");
  91.    }
  92.    $this->Arr_result = array();
  93.    
  94.    $tab_ger_campos = array();
  95.    $tab_def_campos = array();
  96.    $tab_labels     = array();
  97.    $tab_ger_campos['proprietarios_idproprietario'] = "on";
  98.    if ($use_alias == "S")
  99.    {
  100.        $tab_def_campos['proprietarios_idproprietario'] = "proprietarios_idproprietario";
  101.    }
  102.    else
  103.    {
  104.        $tab_def_campos['proprietarios_idproprietario'] = "Proprietarios.idProprietario";
  105.    }
  106.    $tab_labels["proprietarios_idproprietario"]   = (isset($_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_idproprietario"])) ? $_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_idproprietario"] : "Id Proprietario";
  107.    $tab_ger_campos['proprietarios_nome'] = "on";
  108.    if ($use_alias == "S")
  109.    {
  110.        $tab_def_campos['proprietarios_nome'] = "proprietarios_nome";
  111.    }
  112.    else
  113.    {
  114.        $tab_def_campos['proprietarios_nome'] = "Proprietarios.Nome";
  115.    }
  116.    $tab_labels["proprietarios_nome"]   = (isset($_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_nome"])) ? $_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_nome"] : "Nome";
  117.    $tab_ger_campos['proprietarios_sexo'] = "on";
  118.    if ($use_alias == "S")
  119.    {
  120.        $tab_def_campos['proprietarios_sexo'] = "proprietarios_sexo";
  121.    }
  122.    else
  123.    {
  124.        $tab_def_campos['proprietarios_sexo'] = "Proprietarios.Sexo";
  125.    }
  126.    $tab_labels["proprietarios_sexo"]   = (isset($_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_sexo"])) ? $_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_sexo"] : "Sexo";
  127.    $tab_ger_campos['proprietarios_cpf'] = "on";
  128.    if ($use_alias == "S")
  129.    {
  130.        $tab_def_campos['proprietarios_cpf'] = "proprietarios_cpf";
  131.    }
  132.    else
  133.    {
  134.        $tab_def_campos['proprietarios_cpf'] = "Proprietarios.Cpf";
  135.    }
  136.    $tab_labels["proprietarios_cpf"]   = (isset($_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_cpf"])) ? $_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_cpf"] : "Cpf";
  137.    $tab_ger_campos['proprietarios_telefone'] = "on";
  138.    if ($use_alias == "S")
  139.    {
  140.        $tab_def_campos['proprietarios_telefone'] = "proprietarios_telefone";
  141.    }
  142.    else
  143.    {
  144.        $tab_def_campos['proprietarios_telefone'] = "Proprietarios.Telefone";
  145.    }
  146.    $tab_labels["proprietarios_telefone"]   = (isset($_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_telefone"])) ? $_SESSION['sc_session'][$sc_init]['grid_new']['labels']["proprietarios_telefone"] : "Telefone";
  147.    $tab_ger_campos['veiculos_idveiculos'] = "on";
  148.    if ($use_alias == "S")
  149.    {
  150.        $tab_def_campos['veiculos_idveiculos'] = "veiculos_idveiculos";
  151.    }
  152.    else
  153.    {
  154.        $tab_def_campos['veiculos_idveiculos'] = "Veiculos.idVeiculos";
  155.    }
  156.    $tab_labels["veiculos_idveiculos"]   = (isset($_SESSION['sc_session'][$sc_init]['grid_new']['labels']["veiculos_idveiculos"])) ? $_SESSION['sc_session'][$sc_init]['grid_new']['labels']["veiculos_idveiculos"] : "Id Veiculos";
  157.    $tab_ger_campos['veiculos_anomodelo'] = "on";
  158.    if ($use_alias == "S")
  159.    {
  160.        $tab_def_campos['veiculos_anomodelo'] = "veiculos_anomodelo";
  161.    }
  162.    else
  163.    {
  164.        $tab_def_campos['veiculos_anomodelo'] = "Veiculos.AnoModelo";
  165.    }
  166.    $tab_labels["veiculos_anomodelo"]   = (isset($_SESSION['sc_session'][$sc_init]['grid_new']['labels']["veiculos_anomodelo"])) ? $_SESSION['sc_session'][$sc_init]['grid_new']['labels']["veiculos_anomodelo"] : "Ano Modelo";
  167.    $tab_ger_campos['veiculos_placa'] = "on";
  168.    if ($use_alias == "S")
  169.    {
  170.        $tab_def_campos['veiculos_placa'] = "veiculos_placa";
  171.    }
  172.    else
  173.    {
  174.        $tab_def_campos['veiculos_placa'] = "Veiculos.Placa";
  175.    }
  176.    $tab_labels["veiculos_placa"]   = (isset($_SESSION['sc_session'][$sc_init]['grid_new']['labels']["veiculos_placa"])) ? $_SESSION['sc_session'][$sc_init]['grid_new']['labels']["veiculos_placa"] : "Placa";
  177.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']))
  178.    {
  179.        foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display'] as $NM_cada_field => $NM_cada_opc)
  180.        {
  181.            if ($NM_cada_opc == "off")
  182.            {
  183.               $tab_ger_campos[$NM_cada_field] = "none";
  184.            }
  185.        }
  186.    }
  187.    if (isset($_SESSION['sc_session'][$sc_init]['grid_new']['php_cmp_sel']) && !empty($_SESSION['sc_session'][$sc_init]['grid_new']['php_cmp_sel']))
  188.    {
  189.        foreach ($_SESSION['sc_session'][$sc_init]['grid_new']['php_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  190.        {
  191.            if ($NM_cada_opc == "off")
  192.            {
  193.               $tab_ger_campos[$NM_cada_field] = "none";
  194.            }
  195.        }
  196.    }
  197.    if (!isset($_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select']))
  198.    {
  199.        $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select'] = array();
  200.    }
  201.    
  202.    if ($fsel_ok == "cmp" && !$this->restore)
  203.    {
  204.        $this->Sel_processa_out_sel($campos_sel);
  205.    }
  206.    else
  207.    {
  208.        if ($embbed)
  209.        {
  210.            ob_start();
  211.            $this->Sel_processa_form();
  212.            $Temp ob_get_clean();
  213.            echo NM_charset_to_utf8($Temp);
  214.        }
  215.        else
  216.        {
  217.            if ($this->restore)
  218.            {
  219.                ob_start();
  220.            }
  221.            $this->Sel_processa_form();
  222.        }
  223.    }
  224.    exit;
  225.    
  226. }
  227. function Sel_processa_out_sel($campos_sel)
  228. {
  229.    global $tab_ger_campos$sc_init$tab_def_campos$embbed;
  230.    $arr_temp = array();
  231.    $campos_sel explode("@?@"$campos_sel);
  232.    $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select'] = array();
  233.    $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_grid']   = "";
  234.    $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_cmp']    = "";
  235.    foreach ($campos_sel as $campo_sort)
  236.    {
  237.        $ordem = (substr($campo_sort01) == "+") ? "asc" "desc";
  238.        $campo substr($campo_sort1);
  239.        if (isset($tab_def_campos[$campo]))
  240.        {
  241.            $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select'][$tab_def_campos[$campo]] = $ordem;
  242.        }
  243.    }
  244. ?>
  245.     <script language="javascript"> 
  246. <?php
  247.    if (!$embbed)
  248.    {
  249. ?>
  250.       self.parent.tb_remove(); 
  251.       parent.nm_gp_submit_ajax('inicio', ''); 
  252. <?php
  253.    }
  254.    else
  255.    {
  256. ?>
  257.       nm_gp_submit_ajax('inicio', ''); 
  258. <?php
  259.    }
  260. ?>
  261.    </script>
  262. <?php
  263. }
  264.    
  265. function Sel_processa_form()
  266. {
  267.   global $sc_init$path_img$path_btn$use_alias$tab_ger_campos$tab_def_campos$tab_labels$embbed$tbar_pos;
  268.    $size 10;
  269.    $_SESSION['scriptcase']['charset']  = (isset($this->Nm_lang['Nm_charset']) && !empty($this->Nm_lang['Nm_charset'])) ? $this->Nm_lang['Nm_charset'] : "UTF-8";
  270.    foreach ($this->Nm_lang as $ind => $dados)
  271.    {
  272.       if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($ind))
  273.       {
  274.           $ind sc_convert_encoding($ind$_SESSION['scriptcase']['charset'], "UTF-8");
  275.           $this->Nm_lang[$ind] = $dados;
  276.       }
  277.       if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($dados))
  278.       {
  279.           $this->Nm_lang[$ind] = sc_convert_encoding($dados$_SESSION['scriptcase']['charset'], "UTF-8");
  280.       }
  281.    }
  282.    $str_schema_all = (isset($_SESSION['scriptcase']['str_schema_all']) && !empty($_SESSION['scriptcase']['str_schema_all'])) ? $_SESSION['scriptcase']['str_schema_all'] : "Sc9_Midnight/Sc9_Midnight";
  283.    include("../_lib/css/" $str_schema_all "_grid.php");
  284.    $Str_btn_grid trim($str_button) . "/" trim($str_button) . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".php";
  285.    include("../_lib/buttons/" $Str_btn_grid);
  286.    if (!function_exists("nmButtonOutput"))
  287.    {
  288.        include_once("../_lib/lib/php/nm_gp_config_btn.php");
  289.    }
  290.    if (!$embbed)
  291.    {
  292. ?>
  293. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  294.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  295. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  296. <HEAD>
  297.  <TITLE><?php echo $this->Nm_lang['lang_othr_grid_title'?> </TITLE>
  298.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  299.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  300.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  301.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  302.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  303.  <META http-equiv="Pragma" content="no-cache"/>
  304. <?php
  305. if ($_SESSION['scriptcase']['proc_mobile'])
  306. {
  307. ?>
  308.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  309. <?php
  310. }
  311. ?>
  312.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  313.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" /> 
  314.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" /> 
  315.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div'?>" /> 
  316.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div_dir'?>" /> 
  317.  <?php
  318.  if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  319.  {
  320.  ?>
  321.     <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts'?>" />
  322.  <?php
  323.  }
  324.  ?>
  325.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" /> 
  326. </HEAD>
  327. <BODY class="scGridPage" style="margin: 0px; overflow-x: hidden">
  328. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  329. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery-ui.js"></script>
  330. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery_plugin/touch_punch/jquery.ui.touch-punch.min.js"></script>
  331. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>
  332. <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" />
  333. <?php
  334.    }
  335. ?>
  336. <script language="javascript"> 
  337. <?php
  338. if ($embbed)
  339. {
  340. ?>
  341.   function scSubmitOrderCampos(sPos, sType) {
  342.     $("#id_fsel_ok_sel_ord").val(sType);
  343.     if(sType == 'cmp')
  344.     {
  345.        scPackSelectedOrd();
  346.     }
  347.    return new Promise(function(resolve, reject) {$.ajax({
  348.     type: "POST",
  349.     url: "grid_new_order_campos.php",
  350.     data: {
  351.      script_case_init: $("#id_script_case_init_sel_ord").val(),
  352.      script_case_session: $("#id_script_case_session_sel_ord").val(),
  353.      path_img: $("#id_path_img_sel_ord").val(),
  354.      path_btn: $("#id_path_btn_sel_ord").val(),
  355.      use_alias: $("#id_use_alias").val(),
  356.      campos_sel: $("#id_campos_sel_sel_ord").val(),
  357.      sel_regra: $("#id_sel_regra_sel_ord").val(),
  358.      fsel_ok: $("#id_fsel_ok_sel_ord").val(),
  359.      embbed_groupby: 'Y'
  360.     }
  361.    }).done(function(data) {
  362.     scBtnOrderCamposHide(sPos);
  363.     buttonunselectedOF();
  364.     $("#sc_id_order_campos_placeholder_" + sPos).find("td").html("");
  365.     var execString = data.toString().replace(/(\<.*?\>)/g, '');
  366.     eval(execString).then(function(){resolve()});
  367.    });});
  368.   }
  369. <?php
  370. }
  371. ?>
  372.  // Submeter o formularior
  373.  //-------------------------------------
  374.  function submit_form_Fsel_ord()
  375.  {
  376.      scPackSelectedOrd();
  377.       buttonunselectedOF();
  378.       document.Fsel_ord.submit();
  379.  }
  380.  function scPackSelectedOrd() {
  381.   var fieldList, fieldName, i, selectedFields = new Array;
  382.  fieldList = $("#sc_id_fldord_selected").sortable("toArray");
  383.  for (i = 0; i < fieldList.length; i++) {
  384.   fieldName  = fieldList[i].substr(14);
  385.   selectedFields.push($("#sc_id_class_" + fieldName).val() + fieldName);
  386.  }
  387.  $("#id_campos_sel_sel_ord").val( selectedFields.join("@?@") );
  388.  }
  389.  </script>
  390. <FORM name="Fsel_ord" method="POST">
  391.   <INPUT type="hidden" name="script_case_init"    id="id_script_case_init_sel_ord"    value="<?php echo NM_encode_input($sc_init); ?>"> 
  392.   <INPUT type="hidden" name="script_case_session" id="id_script_case_session_sel_ord" value="<?php echo NM_encode_input(session_id()); ?>"> 
  393.   <INPUT type="hidden" name="path_img"            id="id_path_img_sel_ord"            value="<?php echo NM_encode_input($path_img); ?>"> 
  394.   <INPUT type="hidden" name="path_btn"            id="id_path_btn_sel_ord"            value="<?php echo NM_encode_input($path_btn); ?>"> 
  395.   <INPUT type="hidden" name="use_alias"           id="id_use_alias"                   value="<?php echo NM_encode_input($use_alias); ?>"> 
  396.   <INPUT type="hidden" name="fsel_ok"             id="id_fsel_ok_sel_ord"             value=""> 
  397. <?php
  398. if ($embbed)
  399. {
  400.     echo "<div class='scAppDivMoldura'>";
  401.     echo "<table id=\"main_table\" style=\"width: 100%\" cellspacing=0 cellpadding=0>";
  402. }
  403. elseif ($_SESSION['scriptcase']['reg_conf']['html_dir'] == " DIR='RTL'")
  404. {
  405.     echo "<table id=\"main_table\" style=\"position: relative; top: 20px; right: 20px\">";
  406. }
  407. else
  408. {
  409.     echo "<table id=\"main_table\" style=\"position: relative; top: 20px; left: 20px\">";
  410. }
  411. ?>
  412. <?php
  413. if (!$embbed)
  414. {
  415. ?>
  416. <tr>
  417. <td>
  418. <div class="scGridBorder">
  419. <table width='100%' cellspacing=0 cellpadding=0>
  420. <?php
  421. }
  422. ?>
  423.  <tr>
  424.   <td class="<?php echo ($embbed)? 'scAppDivHeader scAppDivHeaderText':'scGridLabelVert'?>">
  425.    <?php echo $this->Nm_lang['lang_btns_sort_hint']; ?>
  426.   </td>
  427.  </tr>
  428.  <tr>
  429.   <td class="<?php echo ($embbed)? 'scAppDivContent css_scAppDivContentText':'scGridTabelaTd'?>">
  430.    <table class="<?php echo ($embbed)? '':'scGridTabela'?>" style="border-width: 0; border-collapse: collapse; width:100%;" cellspacing=0 cellpadding=0>
  431.     <tr class="<?php echo ($embbed)? '':'scGridFieldOddVert'?>">
  432.      <td style="vertical-align: top">
  433.      <table>
  434.    <tr><td style="vertical-align: top">
  435.  <script language="javascript" type="text/javascript">
  436.   $(function() {
  437.    $(".sc_ui_litem").mouseover(function() {
  438.     $(this).css("cursor", "all-scroll");
  439.    });
  440.    $("#sc_id_fldord_available").sortable({
  441.     connectWith: ".sc_ui_fldord_selected",
  442.     placeholder: "scAppDivSelectFieldsPlaceholder",
  443.     remove: function(event, ui) {
  444.      var fieldName = $(ui.item[0]).find("select").attr("id");
  445.      $("#" + fieldName).show();
  446.      $('#f_sel_sub').css('display', 'inline-block');
  447.     }
  448.    }).disableSelection();
  449.    $("#sc_id_fldord_selected").sortable({
  450.     connectWith: ".sc_ui_fldord_available",
  451.     placeholder: "scAppDivSelectFieldsPlaceholder",
  452.     remove: function(event, ui) {
  453.      var fieldName = $(ui.item[0]).find("select").attr("id");
  454.      $("#" + fieldName).hide();
  455.      $('#f_sel_sub').css('display', 'inline-block');
  456.      display_btn_restore_ord();
  457.     },
  458.     change: function( event, ui ) {
  459.      $('#f_sel_sub').css('display', 'inline-block');
  460.       display_btn_restore_ord();
  461.     },
  462.     receive: function( event, ui ) {
  463.      $('#f_sel_sub').css('display', 'inline-block');
  464.      display_btn_restore_ord();
  465.     }
  466.    });
  467.    scUpdateListHeight();
  468.   });
  469.   function scUpdateListHeight() {
  470.    $("#sc_id_fldord_available").css("min-height", "<?php echo sizeof($tab_ger_campos) * 26 ?>px");
  471.    $("#sc_id_fldord_selected").css("min-height", "<?php echo sizeof($tab_ger_campos) * 26 ?>px");
  472.   }
  473.  </script>
  474.  <style type="text/css">
  475.   .sc_ui_sortable_ord {
  476.    list-style-type: none;
  477.    margin: 0;
  478.    min-width: 225px;
  479.   }
  480.   .sc_ui_sortable_ord li {
  481.    margin: 0 3px 3px 3px;
  482.    padding: 1px 3px 1px 15px;
  483.    min-height: 18px;
  484.   }
  485.   .sc_ui_sortable_ord li span {
  486.    position: absolute;
  487.    margin-left: -1.3em;
  488.   }
  489.  </style>
  490.     <ul class="sc_ui_sort_groupby sc_ui_sortable_ord sc_ui_fldord_available scAppDivSelectFields" id="sc_id_fldord_available">
  491. <?php
  492.    if ($this->restore) {
  493.         ob_end_clean();
  494.         ob_start();
  495.    }
  496.    $arr_order = ($this->restore) ? $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select_orig'] : $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select'];
  497.    foreach ($tab_ger_campos as $NM_cada_field => $NM_cada_opc)
  498.    {
  499.        if ($NM_cada_opc != "none")
  500.        {
  501.            if (!isset($arr_order[$tab_def_campos[$NM_cada_field]]))
  502.            {
  503. ?>
  504.      <li class="sc_ui_litem scAppDivSelectFieldsEnabled" id="sc_id_itemord_<?php echo NM_encode_input($NM_cada_field); ?>">
  505.       <?php echo $tab_labels[$NM_cada_field]; ?>
  506.       <select id="sc_id_class_<?php echo NM_encode_input($NM_cada_field); ?>" class="scAppDivToolbarInput" style="display: none" onchange="display_btn_restore_ord();">
  507.        <option value="+">Asc</option>
  508.        <option value="-">Desc</option>
  509.       </select><br/>
  510.      </li>
  511. <?php
  512.            }
  513.        }
  514.    }
  515.    if ($this->restore) {
  516.        $this->Arr_result['fldord_available'] = NM_charset_to_utf8(ob_get_clean());
  517.    }
  518. ?>
  519.     </ul>
  520.    </td>
  521.    <td style="vertical-align: top">
  522.     <ul class="sc_ui_sort_groupby sc_ui_sortable_ord sc_ui_fldord_selected scAppDivSelectFields" id="sc_id_fldord_selected">
  523. <?php
  524.    if ($this->restore) {
  525.        ob_end_clean();
  526.        ob_start();
  527.    }
  528.    $arr_order = ($this->restore) ? $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select_orig'] : $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select'];
  529.    foreach ($tab_ger_campos as $NM_cada_field => $NM_cada_opc)
  530.    {
  531.        if ($NM_cada_opc != "none")
  532.        {
  533.            if (isset($arr_order[$tab_def_campos[$NM_cada_field]]))
  534.            {
  535.                $sAscSelected  " selected";
  536.                $sDescSelected "";
  537.                if ($arr_order[$tab_def_campos[$NM_cada_field]] == "desc")
  538.                {
  539.                    $sAscSelected  "";
  540.                    $sDescSelected " selected";
  541.                }
  542. ?>
  543.      <li class="sc_ui_litem scAppDivSelectFieldsEnabled" id="sc_id_itemord_<?php echo $NM_cada_field?>">
  544.       <?php echo $tab_labels[$NM_cada_field]; ?>
  545.       <select id="sc_id_class_<?php echo NM_encode_input($NM_cada_field); ?>" class="scAppDivToolbarInput" onchange="$('#f_sel_sub').css('display', 'inline-block');display_btn_restore_ord();">
  546.        <option value="+"<?php echo $sAscSelected?>>Asc</option>
  547.        <option value="-"<?php echo $sDescSelected?>>Desc</option>
  548.       </select>
  549.      </li>
  550. <?php
  551.           }
  552.        }
  553.    }
  554.    if ($this->restore) {
  555.        $this->Arr_result['fldord_selected'] = NM_charset_to_utf8(ob_get_clean());
  556.        $oJson = new Services_JSON();
  557.        echo $oJson->encode($this->Arr_result);
  558.        exit;
  559.    }
  560. ?>
  561.     </ul>
  562.     <input type="hidden" name="campos_sel" id="id_campos_sel_sel_ord" value="">
  563.    </td>
  564.    </tr>
  565.    </table>
  566.    </td>
  567.    </tr>
  568.    </table>
  569.   </td>
  570.  </tr>
  571.    <tr><td class="<?php echo ($embbed)? 'scAppDivToolbar':'scGridToolbar'?>">
  572. <?php
  573.   $disp_rest "none";
  574.   if (isset($_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select']) && $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select'] != $_SESSION['sc_session'][$sc_init]['grid_new']['ordem_select_orig']) {
  575.       $disp_rest "";
  576.   }
  577.    if (!$embbed)
  578.    {
  579. ?>
  580.    <?php echo nmButtonOutput($this->arr_buttons"bok_appdiv""document.Fsel_ord.fsel_ok.value='cmp';proc_btn_ord('f_sel_sub','submit_form_Fsel_ord()')""document.Fsel_ord.fsel_ok.value='cmp';proc_btn_ord('f_sel_sub','submit_form_Fsel_ord()')""f_sel_sub""""""""absmiddle""""0px"$path_btn"""""""""""only_text""text_right""""""""""""""");
  581. ?>
  582. <?php
  583.    }
  584.    else
  585.    {
  586. ?>
  587.    <?php echo nmButtonOutput($this->arr_buttons"bapply_appdiv""proc_btn_ord('f_sel_sub','scSubmitOrderCampos(\\'" NM_encode_input($tbar_pos) . "\\', \\'cmp\\')')""proc_btn_ord('f_sel_sub','scSubmitOrderCampos(\\'" NM_encode_input($tbar_pos) . "\\', \\'cmp\\')')""f_sel_sub""""""""absmiddle""""0px"$path_btn"""""""""""only_text""text_right""""""""""""""");
  588. ?>
  589. <?php
  590.    }
  591. ?>
  592.   &nbsp;&nbsp;&nbsp;
  593. <?php
  594.    if (!$embbed)
  595.    {
  596. ?>
  597.    <?php echo nmButtonOutput($this->arr_buttons"brestore_appdiv""proc_btn_ord('Brestore_ord','restore_ord()')""proc_btn_ord('Brestore_ord','restore_ord()')""Brestore_ord""""""""absmiddle""""0px"$path_btn"""""""""""only_text""text_right""""""""""""""");
  598. ?>
  599. <?php
  600.    }
  601.    else
  602.    {
  603. ?>
  604.    <?php echo nmButtonOutput($this->arr_buttons"brestore_appdiv""proc_btn_ord('Brestore_ord','restore_ord()')""proc_btn_ord('Brestore_ord','restore_ord()')""Brestore_ord""""""""absmiddle""""0px"$path_btn"""""""""""only_text""text_right""""""""""""""");
  605. ?>
  606. <?php
  607.    }
  608. ?>
  609.   &nbsp;&nbsp;&nbsp;
  610. <?php
  611.    if (!$embbed)
  612.    {
  613. ?>
  614.    <?php echo nmButtonOutput($this->arr_buttons"bsair_appdiv""self.parent.tb_remove(); buttonunselectedOF();""self.parent.tb_remove(); buttonunselectedOF();""Bsair_ord""""""""absmiddle""""0px"$path_btn"""""""""""only_text""text_right""""""""""""""");
  615. ?>
  616. <?php
  617.    }
  618.    else
  619.    {
  620. ?>
  621.    <?php echo nmButtonOutput($this->arr_buttons"bcancelar_appdiv""scBtnOrderCamposHide('" NM_encode_input($tbar_pos) . "'); buttonunselectedOF();""scBtnOrderCamposHide('" NM_encode_input($tbar_pos) . "'); buttonunselectedOF();""Bsair_ord""""""""absmiddle""""0px"$path_btn"""""""""""only_text""text_right""""""""""""""");
  622. ?>
  623. <?php
  624.    }
  625. ?>
  626.    </td>
  627.    </tr>
  628. <?php
  629. if (!$embbed)
  630. {
  631. ?>
  632. </table>
  633. </div>
  634. </td>
  635. </tr>
  636. <?php
  637. }
  638. ?>
  639. </table>
  640. <?php
  641. if ($embbed)
  642. {
  643. ?>
  644.     </div>
  645. <?php
  646. }
  647. ?>
  648. </FORM>
  649. <script language="javascript"> 
  650. function buttonDisable_ord(buttonId) {
  651.     $("#" + buttonId).prop("disabled", true).addClass("disabled");
  652. }
  653. function buttonEnable_ord(buttonId) {
  654.     $("#" + buttonId).prop("disabled", false).removeClass("disabled");
  655. }
  656. function restore_ord() {
  657.     $.ajax({
  658.         type: 'POST',
  659.         url: "grid_new_order_campos.php",
  660.         data: {
  661.            script_case_init: $("#id_script_case_init_sel_ord").val(),
  662.            script_case_session: $("#id_script_case_session_sel_ord").val(),
  663.            restore: 'ok',
  664.         }
  665.     })
  666.     .done(function(retcombos) {
  667.        eval("Combos = " + retcombos);
  668.        $("#sc_id_fldord_available").html(Combos["fldord_available"]);
  669.        $("#sc_id_fldord_selected").html(Combos["fldord_selected"]);
  670.        buttonDisable_ord("Brestore_ord");
  671.        buttonEnable_ord("f_sel_sub");
  672.        $('#f_sel_sub').css('display', 'inline-block');
  673.     });
  674. }
  675. function buttonSelectedOF() {
  676.    $("#ordcmp_top").addClass("selected");
  677.    $("#ordcmp_bottom").addClass("selected");
  678. }
  679. function buttonunselectedOF() {
  680.    $("#ordcmp_top").removeClass("selected");
  681.    $("#ordcmp_bottom").removeClass("selected");
  682. }
  683. function display_btn_restore_ord() {
  684.     buttonEnable_ord("Brestore_ord");
  685.     buttonEnable_ord("f_sel_sub");
  686. }
  687. function proc_btn_ord(btn, proc) {
  688.     if ($("#" + btn).prop("disabled") == true) {
  689.         return;
  690.     }
  691.     eval (proc);
  692. }
  693. $( document ).ready(function() {
  694.    buttonDisable_ord("f_sel_sub");
  695.    buttonSelectedOF();
  696. <?php
  697.    if ($disp_rest == "none") {
  698. ?>
  699.    buttonDisable_ord("Brestore_ord");
  700. <?php
  701.    }
  702. ?>
  703. });
  704. var bFixed = false;
  705. function ajusta_window_Fsel_ord()
  706. {
  707. <?php
  708.    if ($embbed)
  709.    {
  710. ?>
  711.   return false;
  712. <?php
  713.    }
  714. ?>
  715.   var mt = $(document.getElementById("main_table"));
  716.   if (0 == mt.width() || 0 == mt.height())
  717.   {
  718.     setTimeout("ajusta_window_Fsel_ord()", 50);
  719.     return;
  720.   }
  721.   else if(!bFixed)
  722.   {
  723.     var oOrig = $(document.Fsel_ord.sel_orig),
  724.         oDest = $(document.Fsel_ord.sel_dest),
  725.         mHeight = Math.max(oOrig.height(), oDest.height()),
  726.         mWidth = Math.max(oOrig.width() + 5, oDest.width() + 5);
  727.     oOrig.height(mHeight);
  728.     oOrig.width(mWidth);
  729.     oDest.height(mHeight);
  730.     oDest.width(mWidth + 15);
  731.     bFixed = true;
  732.     if (navigator.userAgent.indexOf("Chrome/") > 0)
  733.     {
  734.       strMaxHeight = Math.min(($(window.parent).height()-80), mt.height());
  735.       self.parent.tb_resize(strMaxHeight + 40, mt.width() + 40);
  736.       setTimeout("ajusta_window_Fsel_ord()", 50);
  737.       return;
  738.     }
  739.   }
  740.   strMaxHeight = Math.min(($(window.parent).height()-80), mt.height());
  741.   self.parent.tb_resize(strMaxHeight + 40, mt.width() + 40);
  742. }
  743. $( document ).ready(function() {
  744.    ajusta_window_Fsel_ord();
  745. });
  746. </script>
  747. <script>
  748.     ajusta_window_Fsel_ord();
  749. </script>
  750. </BODY>
  751. </HTML>
  752. <?php
  753. }
  754. }
Return
grid_new_pesq.class.php
  1. <?php

  2. class grid_new_pesq
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;
  8.    var $cmp_formatado;
  9.    var $nm_data;
  10.    var $Campos_Mens_erro;

  11.    var $comando;
  12.    var $comando_sum;
  13.    var $comando_filtro;
  14.    var $comando_ini;
  15.    var $comando_fim;
  16.    var $NM_operador;
  17.    var $NM_data_qp;
  18.    var $NM_path_filter;
  19.    var $NM_curr_fil;
  20.    var $nm_location;
  21.    var $NM_ajax_opcao;
  22.    var $nmgp_botoes = array();
  23.    var $NM_fil_ant = array();

  24.    /**
  25.     * @access  public
  26.     */
  27.    function __construct()
  28.    {
  29.    }

  30.    /**
  31.     * @access  public
  32.     * @global  string  $bprocessa  
  33.     */
  34.    function monta_busca()
  35.    {
  36.       global $bprocessa;
  37.       include("../_lib/css/" $this->Ini->str_schema_filter "_filter.php");
  38.       $this->Ini->Str_btn_filter trim($str_button) . "/" trim($str_button) . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".php";
  39.       $this->Str_btn_filter_css  trim($str_button) . "/" trim($str_button) . ".css";
  40.       $this->Ini->str_google_fonts = (isset($str_google_fonts) && !empty($str_google_fonts))?$str_google_fonts:'';
  41.       include($this->Ini->path_btn $this->Ini->Str_btn_filter);
  42.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['path_libs_php'] = $this->Ini->path_lib_php;
  43.       $this->Img_sep_filter "/" trim($str_toolbar_separator);
  44.       $this->Block_img_col  trim($str_block_col);
  45.       $this->Block_img_exp  trim($str_block_exp);
  46.       $this->Bubble_tail    trim($str_bubble_tail);
  47.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_gp_config_btn.php""F""nmButtonOutput"); 
  48.       $this->init();
  49.       if ($this->NM_ajax_flag && $this->NM_ajax_opcao == "ajax_grid_search_change_fil")
  50.       {
  51.           $arr_new_fil $this->recupera_filtro($this->NM_ajax_grid_fil);
  52.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = array(); 
  53.           foreach ($arr_new_fil as $tp)
  54.           {
  55.               foreach ($tp as $ind => $cada_dado)
  56.               {
  57.                   $field $cada_dado['field'];
  58.                   if (substr($cada_dado['field'], 03) == "SC_")
  59.                   {
  60.                       $field substr($cada_dado['field'], 3);
  61.                   }
  62.                   if (substr($cada_dado['field'], 06) == "id_ac_")
  63.                   {
  64.                       $field substr($cada_dado['field'], 6);
  65.                   }
  66.                   if (is_array($cada_dado['value']))
  67.                   {
  68.                       $arr_tmp = array();
  69.                       foreach($cada_dado['value'] as $ix => $dados)
  70.                       {
  71.                           if (isset($dados['opt']))
  72.                           {
  73.                               $arr_tmp[] = $dados['opt'];
  74.                           }
  75.                           else
  76.                           {
  77.                               $arr_tmp[] = $dados;
  78.                           }
  79.                       }
  80.                       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$field] = $arr_tmp
  81.                   }
  82.                   else
  83.                   {
  84.                       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$field] = $cada_dado['value']; 
  85.                   }
  86.               }
  87.           }
  88.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  89.           {
  90.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = NM_conv_charset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'], $_SESSION['scriptcase']['charset'], "UTF-8");
  91.           }
  92.           $this->processa_busca();
  93.           if (!empty($this->Campos_Mens_erro)) 
  94.           {
  95.               scriptcase_error_display($this->Campos_Mens_erro""); 
  96.               return false;
  97.           }
  98.           return true;
  99.       }
  100.       if ($this->NM_ajax_flag && $this->NM_ajax_opcao == "ajax_grid_search")
  101.       {
  102.          $this->processa_busca();
  103.          return;
  104.       }
  105.       if ($this->NM_ajax_flag)
  106.       {
  107.           ob_start();
  108.           $this->Arr_result = array();
  109.           $this->processa_ajax();
  110.           $Temp ob_get_clean();
  111.           if ($Temp !== false && trim($Temp) != "")
  112.           {
  113.               $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  114.           }
  115.           $oJson = new Services_JSON();
  116.           echo $oJson->encode($this->Arr_result);
  117.           if ($this->Db)
  118.           {
  119.               $this->Db->Close(); 
  120.           }
  121.           exit;
  122.       }
  123.       if (isset($bprocessa) && "pesq" == $bprocessa)
  124.       {
  125.          $this->processa_busca();
  126.       }
  127.       else
  128.       {
  129.          $this->monta_formulario();
  130.       }
  131.    }

  132.    /**
  133.     * @access  public
  134.     */
  135.    function monta_formulario()
  136.    {
  137.       $this->monta_html_ini();
  138.       $this->monta_cabecalho();
  139.       $this->monta_form();
  140.       $this->monta_html_fim();
  141.    }

  142.    /**
  143.     * @access  public
  144.     */
  145.    function init()
  146.    {
  147.       global $bprocessa;
  148.       $_SESSION['scriptcase']['sc_tab_meses']['int'] = array(
  149.                                   $this->Ini->Nm_lang['lang_mnth_janu'],
  150.                                   $this->Ini->Nm_lang['lang_mnth_febr'],
  151.                                   $this->Ini->Nm_lang['lang_mnth_marc'],
  152.                                   $this->Ini->Nm_lang['lang_mnth_apri'],
  153.                                   $this->Ini->Nm_lang['lang_mnth_mayy'],
  154.                                   $this->Ini->Nm_lang['lang_mnth_june'],
  155.                                   $this->Ini->Nm_lang['lang_mnth_july'],
  156.                                   $this->Ini->Nm_lang['lang_mnth_augu'],
  157.                                   $this->Ini->Nm_lang['lang_mnth_sept'],
  158.                                   $this->Ini->Nm_lang['lang_mnth_octo'],
  159.                                   $this->Ini->Nm_lang['lang_mnth_nove'],
  160.                                   $this->Ini->Nm_lang['lang_mnth_dece']);
  161.       $_SESSION['scriptcase']['sc_tab_meses']['abr'] = array(
  162.                                   $this->Ini->Nm_lang['lang_shrt_mnth_janu'],
  163.                                   $this->Ini->Nm_lang['lang_shrt_mnth_febr'],
  164.                                   $this->Ini->Nm_lang['lang_shrt_mnth_marc'],
  165.                                   $this->Ini->Nm_lang['lang_shrt_mnth_apri'],
  166.                                   $this->Ini->Nm_lang['lang_shrt_mnth_mayy'],
  167.                                   $this->Ini->Nm_lang['lang_shrt_mnth_june'],
  168.                                   $this->Ini->Nm_lang['lang_shrt_mnth_july'],
  169.                                   $this->Ini->Nm_lang['lang_shrt_mnth_augu'],
  170.                                   $this->Ini->Nm_lang['lang_shrt_mnth_sept'],
  171.                                   $this->Ini->Nm_lang['lang_shrt_mnth_octo'],
  172.                                   $this->Ini->Nm_lang['lang_shrt_mnth_nove'],
  173.                                   $this->Ini->Nm_lang['lang_shrt_mnth_dece']);
  174.       $_SESSION['scriptcase']['sc_tab_dias']['int'] = array(
  175.                                   $this->Ini->Nm_lang['lang_days_sund'],
  176.                                   $this->Ini->Nm_lang['lang_days_mond'],
  177.                                   $this->Ini->Nm_lang['lang_days_tued'],
  178.                                   $this->Ini->Nm_lang['lang_days_wend'],
  179.                                   $this->Ini->Nm_lang['lang_days_thud'],
  180.                                   $this->Ini->Nm_lang['lang_days_frid'],
  181.                                   $this->Ini->Nm_lang['lang_days_satd']);
  182.       $_SESSION['scriptcase']['sc_tab_dias']['abr'] = array(
  183.                                   $this->Ini->Nm_lang['lang_shrt_days_sund'],
  184.                                   $this->Ini->Nm_lang['lang_shrt_days_mond'],
  185.                                   $this->Ini->Nm_lang['lang_shrt_days_tued'],
  186.                                   $this->Ini->Nm_lang['lang_shrt_days_wend'],
  187.                                   $this->Ini->Nm_lang['lang_shrt_days_thud'],
  188.                                   $this->Ini->Nm_lang['lang_shrt_days_frid'],
  189.                                   $this->Ini->Nm_lang['lang_shrt_days_satd']);
  190.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_functions.php""""") ; 
  191.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_api.php""""") ; 
  192.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_data.class.php""C""nm_data") ; 
  193.       $this->nm_data = new nm_data("en_us");
  194.       $pos_path strrpos($this->Ini->path_prod"/");
  195.       $this->NM_path_filter $this->Ini->root substr($this->Ini->path_prod0$pos_path) . "/conf/filters/";
  196.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "igual";
  197.    }

  198.    function processa_ajax()
  199.    {
  200.       global $NM_filters$NM_filters_del$nmgp_save_name$nmgp_save_option$NM_fields_refresh$NM_parms_refresh$Campo_bi$Opc_bi$NM_operador$nmgp_save_origem;
  201. //-- ajax metodos ---
  202.       if ($this->NM_ajax_opcao == "ajax_filter_save")
  203.       {
  204.           ob_end_clean();
  205.           ob_end_clean();
  206.           $this->salva_filtro($nmgp_save_origem);
  207.           $this->NM_fil_ant $this->gera_array_filtros();
  208.           $Nome_filter "";
  209.           $Opt_filter  "<option value=\"\"></option>\r\n";
  210.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  211.           {
  212.               if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  213.               {
  214.                   $Tipo_filter[1] = sc_convert_encoding($Tipo_filter[1], "UTF-8"$_SESSION['scriptcase']['charset']);
  215.               }
  216.               if ($Tipo_filter[1] != $Nome_filter)
  217.               {
  218.                   $Nome_filter $Tipo_filter[1];
  219.                   $Opt_filter .= "<option value=\"\">" grid_new_pack_protect_string($Nome_filter) . "</option>\r\n";
  220.               }
  221.               $Opt_filter .= "<option value=\"" grid_new_pack_protect_string($Tipo_filter[0]) . "\">.." grid_new_pack_protect_string($Cada_filter) .  "</option>\r\n";
  222.           }
  223.           if (isset($nmgp_save_origem) && $nmgp_save_origem == "grid")
  224.           {
  225.               $Ajax_select  "<SELECT id=\"id_sel_recup_filters\" class=\"scFilterToolbar_obj\" name=\"sel_recup_filters\" onChange=\"nm_change_grid_search(this)\" size=\"1\">\r\n";
  226.               $Ajax_select .= $Opt_filter;
  227.               $Ajax_select .= "</SELECT>\r\n";
  228.               $this->Arr_result['setValue'][] = array('field' => "id_NM_filters_save"'value' => $Ajax_select);
  229.               $Ajax_select "<SELECT id=\"sel_filters_del\" class=\"scFilterToolbar_obj\" name=\"NM_filters_del\" size=\"1\">\r\n";
  230.               $Ajax_select .= $Opt_filter;
  231.               $Ajax_select .= "</SELECT>\r\n";
  232.               $this->Arr_result['setValue'][] = array('field' => "id_sel_filters_del"'value' => $Ajax_select);
  233.               return;
  234.           }
  235.           $Ajax_select  "<SELECT id=\"sel_recup_filters_bot\" name=\"NM_filters_bot\" onChange=\"nm_submit_filter(this, 'bot');\" size=\"1\">\r\n";
  236.           $Ajax_select .= $Opt_filter;
  237.           $Ajax_select .= "</SELECT>\r\n";
  238.           $this->Arr_result['setValue'][] = array('field' => "idAjaxSelect_NM_filters_bot"'value' => $Ajax_select);
  239.           $Ajax_select "<SELECT id=\"sel_filters_del_bot\" class=\"scFilterToolbar_obj\" name=\"NM_filters_del_bot\" size=\"1\">\r\n";
  240.           $Ajax_select .= $Opt_filter;
  241.           $Ajax_select .= "</SELECT>\r\n";
  242.           $this->Arr_result['setValue'][] = array('field' => "idAjaxSelect_NM_filters_del_bot"'value' => $Ajax_select);
  243.       }

  244.       if ($this->NM_ajax_opcao == "ajax_filter_delete")
  245.       {
  246.           ob_end_clean();
  247.           ob_end_clean();
  248.           $this->apaga_filtro();
  249.           $this->NM_fil_ant $this->gera_array_filtros();
  250.           $Nome_filter "";
  251.           $Opt_filter  "<option value=\"\"></option>\r\n";
  252.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  253.           {
  254.               if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  255.               {
  256.                   $Tipo_filter[1] = sc_convert_encoding($Tipo_filter[1], "UTF-8"$_SESSION['scriptcase']['charset']);
  257.               }
  258.               if ($Tipo_filter[1] != $Nome_filter)
  259.               {
  260.                   $Nome_filter  $Tipo_filter[1];
  261.                   $Opt_filter .= "<option value=\"\">" .  grid_new_pack_protect_string($Nome_filter) . "</option>\r\n";
  262.               }
  263.               $Opt_filter .= "<option value=\"" grid_new_pack_protect_string($Tipo_filter[0]) . "\">.." grid_new_pack_protect_string($Cada_filter) .  "</option>\r\n";
  264.           }
  265.           if (isset($nmgp_save_origem) && $nmgp_save_origem == "grid")
  266.           {
  267.               $Ajax_select  "<SELECT id=\"id_sel_recup_filters\" class=\"scFilterToolbar_obj\" name=\"sel_recup_filters\" onChange=\"nm_change_grid_search(this)\" size=\"1\">\r\n";
  268.               $Ajax_select .= $Opt_filter;
  269.               $Ajax_select .= "</SELECT>\r\n";
  270.               $this->Arr_result['setValue'][] = array('field' => "id_NM_filters_save"'value' => $Ajax_select);
  271.               $Ajax_select "<SELECT id=\"sel_filters_del\" class=\"scFilterToolbar_obj\" name=\"NM_filters_del\" size=\"1\">\r\n";
  272.               $Ajax_select .= $Opt_filter;
  273.               $Ajax_select .= "</SELECT>\r\n";
  274.               $this->Arr_result['setValue'][] = array('field' => "id_sel_filters_del"'value' => $Ajax_select);
  275.               return;
  276.           }
  277.           $Ajax_select  "<SELECT id=\"sel_recup_filters_bot\" class=\"scFilterToolbar_obj\" style=\"display:". (count($this->NM_fil_ant)>0?'':'none') .";\" name=\"NM_filters_bot\" onChange=\"nm_submit_filter(this, 'bot');\" size=\"1\">\r\n";
  278.           $Ajax_select .= $Opt_filter;
  279.           $Ajax_select .= "</SELECT>\r\n";
  280.           $this->Arr_result['setValue'][] = array('field' => "idAjaxSelect_NM_filters_bot"'value' => $Ajax_select);
  281.           $Ajax_select "<SELECT id=\"sel_filters_del_bot\" class=\"scFilterToolbar_obj\" name=\"NM_filters_del_bot\" size=\"1\">\r\n";
  282.           $Ajax_select .= $Opt_filter;
  283.           $Ajax_select .= "</SELECT>\r\n";
  284.           $this->Arr_result['setValue'][] = array('field' => "idAjaxSelect_NM_filters_del_bot"'value' => $Ajax_select);
  285.       }
  286.       if ($this->NM_ajax_opcao == "ajax_filter_select")
  287.       {
  288.           ob_end_clean();
  289.           ob_end_clean();
  290.           $this->Arr_result $this->recupera_filtro($NM_filters);
  291.       }

  292.       if ($this->NM_ajax_opcao == 'autocomp_proprietarios_nome')
  293.       {
  294.           $proprietarios_nome = ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($_GET['q'])) ? sc_convert_encoding($_GET['q'], $_SESSION['scriptcase']['charset'], "UTF-8") : $_GET['q'];
  295.           $nmgp_def_dados $this->lookup_ajax_proprietarios_nome($proprietarios_nome);
  296.           ob_end_clean();
  297.           ob_end_clean();
  298.           $count_aut_comp 0;
  299.           $resp_aut_comp  = array();
  300.           foreach ($nmgp_def_dados as $Ind => $Lista)
  301.           {
  302.              if (is_array($Lista))
  303.              {
  304.                  foreach ($Lista as $Cod => $Valor)
  305.                  {
  306.                      if ($_GET['cod_desc'] == "S")
  307.                      {
  308.                          $Valor $Cod " - " $Valor;
  309.                      }
  310.                      $resp_aut_comp[] = array('label' => $Valor 'value' => $Cod);
  311.                      $count_aut_comp++;
  312.                  }
  313.              }
  314.              if ($count_aut_comp == $_GET['max_itens'])
  315.              {
  316.                  break;
  317.              }
  318.           }
  319.           $oJson = new Services_JSON();
  320.           echo $oJson->encode($resp_aut_comp);
  321.           $this->Db->Close(); 
  322.           exit;
  323.       }
  324.       if ($this->NM_ajax_opcao == 'autocomp_proprietarios_sexo')
  325.       {
  326.           $proprietarios_sexo = ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($_GET['q'])) ? sc_convert_encoding($_GET['q'], $_SESSION['scriptcase']['charset'], "UTF-8") : $_GET['q'];
  327.           $nmgp_def_dados $this->lookup_ajax_proprietarios_sexo($proprietarios_sexo);
  328.           ob_end_clean();
  329.           ob_end_clean();
  330.           $count_aut_comp 0;
  331.           $resp_aut_comp  = array();
  332.           foreach ($nmgp_def_dados as $Ind => $Lista)
  333.           {
  334.              if (is_array($Lista))
  335.              {
  336.                  foreach ($Lista as $Cod => $Valor)
  337.                  {
  338.                      if ($_GET['cod_desc'] == "S")
  339.                      {
  340.                          $Valor $Cod " - " $Valor;
  341.                      }
  342.                      $resp_aut_comp[] = array('label' => $Valor 'value' => $Cod);
  343.                      $count_aut_comp++;
  344.                  }
  345.              }
  346.              if ($count_aut_comp == $_GET['max_itens'])
  347.              {
  348.                  break;
  349.              }
  350.           }
  351.           $oJson = new Services_JSON();
  352.           echo $oJson->encode($resp_aut_comp);
  353.           $this->Db->Close(); 
  354.           exit;
  355.       }
  356.    }
  357.    function lookup_ajax_proprietarios_nome($proprietarios_nome)
  358.    {
  359.       $proprietarios_nome substr($this->Db->qstr($proprietarios_nome), 1, -1);
  360.             $proprietarios_nome_look substr($this->Db->qstr($proprietarios_nome), 1, -1); 
  361.       $nmgp_def_dados = array(); 
  362.       $nm_comando "select distinct Proprietarios.Nome from " $this->Ini->nm_tabela " where  Proprietarios.Nome like '%" $proprietarios_nome "%' order by Proprietarios.Nome"
  363.       unset($cmp1,$cmp2);
  364.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  365.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  366.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  367.       { 
  368.          while (!$rs->EOF
  369.          { 
  370.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  371.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  372.             $rs->MoveNext() ; 
  373.          } 
  374.          $rs->Close() ; 
  375.       } 
  376.       else  
  377.       {  
  378.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  379.          exit; 
  380.       } 

  381.       return $nmgp_def_dados;
  382.    }
  383.    
  384.    function lookup_ajax_proprietarios_sexo($proprietarios_sexo)
  385.    {
  386.       $proprietarios_sexo substr($this->Db->qstr($proprietarios_sexo), 1, -1);
  387.             $proprietarios_sexo_look substr($this->Db->qstr($proprietarios_sexo), 1, -1); 
  388.       $nmgp_def_dados = array(); 
  389.       $nm_comando "select distinct Proprietarios.Sexo from " $this->Ini->nm_tabela " where  Proprietarios.Sexo like '%" $proprietarios_sexo "%' order by Proprietarios.Sexo"
  390.       unset($cmp1,$cmp2);
  391.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  392.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  393.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  394.       { 
  395.          while (!$rs->EOF
  396.          { 
  397.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  398.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  399.             $rs->MoveNext() ; 
  400.          } 
  401.          $rs->Close() ; 
  402.       } 
  403.       else  
  404.       {  
  405.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  406.          exit; 
  407.       } 

  408.       return $nmgp_def_dados;
  409.    }
  410.    

  411.    /**
  412.     * @access  public
  413.     */
  414.    function processa_busca()
  415.    {
  416.       $this->inicializa_vars();
  417.       $this->trata_campos();
  418.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  419.       {
  420.           $this->finaliza_resultado_ajax();
  421.           return;
  422.       }
  423.       if (!empty($this->Campos_Mens_erro)) 
  424.       {
  425.           $this->monta_formulario();
  426.       }
  427.       else
  428.       {
  429.           $this->finaliza_resultado();
  430.       }
  431.    }

  432.    /**
  433.     * @access  public
  434.     */
  435.    function and_or()
  436.    {
  437.       $posWhere strpos(strtolower($this->comando), "where");
  438.       if (FALSE === $posWhere)
  439.       {
  440.          $this->comando     .= " where (";
  441.          $this->comando_sum .= " and (";
  442.          $this->comando_fim  " ) ";
  443.       }
  444.       if ($this->comando_ini == "ini")
  445.       {
  446.           if (FALSE !== $posWhere)
  447.           {
  448.               $this->comando     .= " and ( ";
  449.               $this->comando_sum .= " and ( ";
  450.               $this->comando_fim  " ) ";
  451.           }
  452.          $this->comando_ini  "";
  453.       }
  454.       elseif ("or" == $this->NM_operador)
  455.       {
  456.          $this->comando        .= " or ";
  457.          $this->comando_sum    .= " or ";
  458.          $this->comando_filtro .= " or ";
  459.       }
  460.       else
  461.       {
  462.          $this->comando        .= " and ";
  463.          $this->comando_sum    .= " and ";
  464.          $this->comando_filtro .= " and ";
  465.       }
  466.    }

  467.    /**
  468.     * @access  public
  469.     * @param  string  $nome  
  470.     * @param  string  $condicao  
  471.     * @param  mixed  $campo  
  472.     * @param  mixed  $campo2  
  473.     * @param  string  $nome_campo  
  474.     * @param  string  $tp_campo  
  475.     * @global  array  $nmgp_tab_label  
  476.     */
  477.    function monta_condicao($nome$condicao$campo$campo2 ""$nome_campo=""$tp_campo="")
  478.    {
  479.       global $nmgp_tab_label;
  480.       $condicao   strtoupper($condicao);
  481.       $nm_aspas   "'";
  482.       $nm_aspas1  "'";
  483.       $Nm_numeric = array();
  484.       $nm_esp_postgres = array();
  485.       $nm_ini_lower "";
  486.       $nm_fim_lower "";
  487.       $Nm_numeric[] = "proprietarios_idproprietario";$Nm_numeric[] = "proprietarios_cpf";$Nm_numeric[] = "veiculos_idveiculos";$Nm_numeric[] = "veiculos_idproprietario_fk";
  488.       $campo_join strtolower(str_replace(".""_"$nome));
  489.       if (in_array($campo_join$Nm_numeric))
  490.       {
  491.           if ($condicao == "EP" || $condicao == "NE")
  492.           {
  493.               unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$campo_join]);
  494.               return;
  495.           }
  496.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['decimal_db'] == ".")
  497.          {
  498.             $nm_aspas  "";
  499.             $nm_aspas1 "";
  500.          }
  501.          if ($condicao != "IN")
  502.          {
  503.             if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['decimal_db'] == ".")
  504.             {
  505.                $campo  str_replace(",""."$campo);
  506.                $campo2 str_replace(",""."$campo2);
  507.             }
  508.             if ($campo == "")
  509.             {
  510.                $campo 0;
  511.             }
  512.             if ($campo2 == "")
  513.             {
  514.                $campo2 0;
  515.             }
  516.          }
  517.       }
  518.       if ($campo == "" && $condicao != "NU" && $condicao != "NN" && $condicao != "EP" && $condicao != "NE")
  519.       {
  520.          return;
  521.       }
  522.       else
  523.       {
  524.          $tmp_pos strpos($campo"##@@");
  525.          if ($tmp_pos === false)
  526.          {
  527.              $res_lookup $campo;
  528.          }
  529.          else
  530.          {
  531.              $res_lookup substr($campo$tmp_pos 4);
  532.              $campo substr($campo0$tmp_pos);
  533.              if ($campo == "" && $condicao != "NU" && $condicao != "NN" && $condicao != "EP" && $condicao != "NE")
  534.              {
  535.                  return;
  536.              }
  537.          }
  538.          $tmp_pos strpos($this->cmp_formatado[$nome_campo], "##@@");
  539.          if ($tmp_pos !== false)
  540.          {
  541.              $this->cmp_formatado[$nome_campo] = substr($this->cmp_formatado[$nome_campo], $tmp_pos 4);
  542.          }
  543.          $this->and_or();
  544.          $campo  substr($this->Db->qstr($campo), 1, -1);
  545.          $campo2 substr($this->Db->qstr($campo2), 1, -1);
  546.          $nome_sum "$nome";
  547.          if ($tp_campo == "TIMESTAMP")
  548.          {
  549.              $tp_campo "DATETIME";
  550.          }
  551.          if (in_array($campo_join$Nm_numeric) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && ($condicao == "II" || $condicao == "QP" || $condicao == "NP"))
  552.          {
  553.              $nome     "CAST ($nome AS TEXT)";
  554.              $nome_sum "CAST ($nome_sum AS TEXT)";
  555.          }
  556.          if (in_array($campo_join$nm_esp_postgres) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  557.          {
  558.              $nome     "CAST ($nome AS TEXT)";
  559.              $nome_sum "CAST ($nome_sum AS TEXT)";
  560.          }
  561.          if (substr($tp_campo08) == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && !$this->Date_part)
  562.          {
  563.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  564.                  $nome     "to_char ($nome, 'YYYY-MM-DD hh24:mi:ss')";
  565.                  $nome_sum "to_char ($nome_sum, 'YYYY-MM-DD hh24:mi:ss')";
  566.              }
  567.          }
  568.          elseif (substr($tp_campo04) == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && !$this->Date_part)
  569.          {
  570.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  571.                  $nome     "to_char ($nome, 'YYYY-MM-DD')";
  572.                  $nome_sum "to_char ($nome_sum, 'YYYY-MM-DD')";
  573.              }
  574.          }
  575.          elseif (substr($tp_campo04) == "TIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && !$this->Date_part)
  576.          {
  577.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  578.                  $nome     "to_char ($nome, 'hh24:mi:ss')";
  579.                  $nome_sum "to_char ($nome_sum, 'hh24:mi:ss')";
  580.              }
  581.          }
  582.          if ($tp_campo == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql) && !$this->Date_part)
  583.          {
  584.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  585.                  $nome     "convert(char(10),$nome,121)";
  586.                  $nome_sum "convert(char(10),$nome_sum,121)";
  587.              }
  588.          }
  589.          if ($tp_campo == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql) && !$this->Date_part)
  590.          {
  591.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  592.                  $nome     "convert(char(19),$nome,121)";
  593.                  $nome_sum "convert(char(19),$nome_sum,121)";
  594.              }
  595.          }
  596.          if (substr($tp_campo08) == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle) && !$this->Date_part)
  597.          {
  598.              $nome     "TO_DATE(TO_CHAR($nome, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss')";
  599.              $nome_sum "TO_DATE(TO_CHAR($nome_sum, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss')";
  600.              $tp_campo "DATETIME";
  601.          }
  602.          if (substr($tp_campo08) == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix) && !$this->Date_part)
  603.          {
  604.              $nome     "EXTEND($nome, YEAR TO FRACTION)";
  605.              $nome_sum "EXTEND($nome_sum, YEAR TO FRACTION)";
  606.          }
  607.          elseif (substr($tp_campo04) == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix) && !$this->Date_part)
  608.          {
  609.              $nome     "EXTEND($nome, YEAR TO DAY)";
  610.              $nome_sum "EXTEND($nome_sum, YEAR TO DAY)";
  611.          }
  612.          if (in_array($campo_join$Nm_numeric) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress) && ($condicao == "II" || $condicao == "QP" || $condicao == "NP"))
  613.          {
  614.              $nome     "CAST ($nome AS VARCHAR(255))";
  615.              $nome_sum "CAST ($nome_sum AS VARCHAR(255))";
  616.          }
  617.          if (substr($tp_campo08) == "DATETIME" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress) && !$this->Date_part)
  618.          {
  619.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  620.                  $nome     "to_char ($nome, 'YYYY-MM-DD hh24:mi:ss')";
  621.                  $nome_sum "to_char ($nome_sum, 'YYYY-MM-DD hh24:mi:ss')";
  622.              }
  623.          }
  624.          if (substr($tp_campo04) == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress) && !$this->Date_part)
  625.          {
  626.              if (in_array($condicao, array('II','QP','NP','IN','EP','NE'))) {
  627.                  $nome     "to_char ($nome, 'YYYY-MM-DD')";
  628.                  $nome_sum "to_char ($nome_sum, 'YYYY-MM-DD')";
  629.              }
  630.          }
  631.          switch ($condicao)
  632.          {
  633.             case "EQ":     // 
  634.                $this->comando        .= $nm_ini_lower $nome $nm_fim_lower " = " $nm_aspas $campo $nm_aspas1;
  635.                $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower " = " $nm_aspas $campo $nm_aspas1;
  636.                $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower" = " $nm_aspas $campo $nm_aspas1;
  637.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_equl'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  638.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  639.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_equl'] . " " $this->cmp_formatado[$nome_campo];
  640.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_equl'] . " " $this->cmp_formatado[$nome_campo];
  641.             break;
  642.             case "II":     // 
  643.                $this->comando        .= $nm_ini_lower $nome $nm_fim_lower " like '" $campo "%'";
  644.                $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower " like '" $campo "%'";
  645.                $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower " like '" $campo "%'";
  646.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_strt'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  647.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  648.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_strt'] . " " $this->cmp_formatado[$nome_campo];
  649.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_strt'] . " " $this->cmp_formatado[$nome_campo];
  650.             break;
  651.              case "QP";     // 
  652.              case "NP";     // 
  653.                 $concat " " $this->NM_operador " ";
  654.                 if ($condicao == "QP")
  655.                 {
  656.                     $op_all    " like ";
  657.                     $lang_like $this->Ini->Nm_lang['lang_srch_like'];
  658.                 }
  659.                 else
  660.                 {
  661.                     $op_all    " not like ";
  662.                     $lang_like $this->Ini->Nm_lang['lang_srch_not_like'];
  663.                 }
  664.                $NM_cond    "";
  665.                $NM_cmd     "";
  666.                $NM_cmd_sum "";
  667.                if (substr($tp_campo04) == "DATE" && $this->Date_part)
  668.                {
  669.                    if ($this->NM_data_qp['ano'] != "____")
  670.                    {
  671.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  672.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_year'] . " " $this->Lang_date_part " " $this->NM_data_qp['ano'];
  673.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  674.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  675.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  676.                        {
  677.                            $NM_cmd     .= "strftime('%Y', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  678.                            $NM_cmd_sum .= "strftime('%Y', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  679.                        }
  680.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  681.                        {
  682.                            $NM_cmd     .= "extract(year from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  683.                            $NM_cmd_sum .= "extract(year from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  684.                        }
  685.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  686.                        {
  687.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  688.                            {
  689.                                $NM_cmd     .= "to_char (" $nome ", 'YYYY') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  690.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'YYYY') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  691.                            }
  692.                            else
  693.                            {
  694.                                $NM_cmd     .= $this->Ini_date_char "extract('year' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  695.                                $NM_cmd_sum .= $this->Ini_date_char "extract('year' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  696.                            }
  697.                        }
  698.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  699.                        {
  700.                            $NM_cmd     .= "extract(year from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  701.                            $NM_cmd_sum .= "extract(year from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  702.                        }
  703.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  704.                        {
  705.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'YYYY')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  706.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'YYYY')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  707.                        }
  708.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  709.                        {
  710.                            $NM_cmd     .= "DATEPART(year, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  711.                            $NM_cmd_sum .= "DATEPART(year, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  712.                        }
  713.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  714.                        {
  715.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  716.                            {
  717.                                $NM_cmd     .= "to_char (" $nome ", 'YYYY') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  718.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'YYYY') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  719.                            }
  720.                            else
  721.                            {
  722.                                $NM_cmd     .= "year (" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  723.                                $NM_cmd_sum .= "year (" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  724.                            }
  725.                        }
  726.                        else
  727.                        {
  728.                            $NM_cmd     .= "year(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  729.                            $NM_cmd_sum .= "year(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['ano'] . $this->End_date_part;
  730.                        }
  731.                    }
  732.                    if ($this->NM_data_qp['mes'] != "__")
  733.                    {
  734.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  735.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_mnth'] . " " $this->Lang_date_part " " $this->NM_data_qp['mes'];
  736.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  737.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  738.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  739.                        {
  740.                            $NM_cmd     .= "strftime('%m', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  741.                            $NM_cmd_sum .= "strftime('%m', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  742.                        }
  743.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  744.                        {
  745.                            $NM_cmd     .= "extract(month from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  746.                            $NM_cmd_sum .= "extract(month from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  747.                        }
  748.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  749.                        {
  750.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  751.                            {
  752.                                $NM_cmd     .= "to_char (" $nome ", 'MM') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  753.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'MM') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  754.                            }
  755.                            else
  756.                            {
  757.                                $NM_cmd     .= $this->Ini_date_char "extract('month' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  758.                                $NM_cmd_sum .= $this->Ini_date_char "extract('month' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  759.                            }
  760.                        }
  761.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  762.                        {
  763.                            $NM_cmd     .= "extract(month from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  764.                            $NM_cmd_sum .= "extract(month from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  765.                        }
  766.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  767.                        {
  768.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'MM')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  769.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'MM')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  770.                        }
  771.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  772.                        {
  773.                            $NM_cmd     .= "DATEPART(month, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  774.                            $NM_cmd_sum .= "DATEPART(month, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  775.                        }
  776.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  777.                        {
  778.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  779.                            {
  780.                                $NM_cmd     .= "to_char (" $nome ", 'MM') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  781.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'MM') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  782.                            }
  783.                            else
  784.                            {
  785.                                $NM_cmd     .= "month (" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  786.                                $NM_cmd_sum .= "month (" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  787.                            }
  788.                        }
  789.                        else
  790.                        {
  791.                            $NM_cmd     .= "month(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  792.                            $NM_cmd_sum .= "month(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['mes'] . $this->End_date_part;
  793.                        }
  794.                    }
  795.                    if ($this->NM_data_qp['dia'] != "__")
  796.                    {
  797.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  798.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_days'] . " " $this->Lang_date_part " " $this->NM_data_qp['dia'];
  799.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  800.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  801.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  802.                        {
  803.                            $NM_cmd     .= "strftime('%d', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  804.                            $NM_cmd_sum .= "strftime('%d', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  805.                        }
  806.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  807.                        {
  808.                            $NM_cmd     .= "extract(day from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  809.                            $NM_cmd_sum .= "extract(day from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  810.                        }
  811.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  812.                        {
  813.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  814.                            {
  815.                                $NM_cmd     .= "to_char (" $nome ", 'DD') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  816.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'DD') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  817.                            }
  818.                            else
  819.                            {
  820.                                $NM_cmd     .= $this->Ini_date_char "extract('day' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  821.                                $NM_cmd_sum .= $this->Ini_date_char "extract('day' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  822.                            }
  823.                        }
  824.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  825.                        {
  826.                            $NM_cmd     .= "extract(day from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  827.                            $NM_cmd_sum .= "extract(day from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  828.                        }
  829.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  830.                        {
  831.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'DD')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  832.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'DD')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  833.                        }
  834.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  835.                        {
  836.                            $NM_cmd     .= "DATEPART(day, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  837.                            $NM_cmd_sum .= "DATEPART(day, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  838.                        }
  839.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  840.                        {
  841.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  842.                            {
  843.                                $NM_cmd     .= "to_char (" $nome ", 'DD') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  844.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'DD') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  845.                            }
  846.                            else
  847.                            {
  848.                                $NM_cmd     .= "DAYOFMONTH(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  849.                                $NM_cmd_sum .= "DAYOFMONTH(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  850.                            }
  851.                        }
  852.                        else
  853.                        {
  854.                            $NM_cmd     .= "day(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  855.                            $NM_cmd_sum .= "day(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['dia'] . $this->End_date_part;
  856.                        }
  857.                    }
  858.                }
  859.                if (strpos($tp_campo"TIME") !== false && $this->Date_part)
  860.                {
  861.                    if ($this->NM_data_qp['hor'] != "__")
  862.                    {
  863.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  864.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_time'] . " " $this->Lang_date_part " " $this->NM_data_qp['hor'];
  865.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  866.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  867.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  868.                        {
  869.                            $NM_cmd     .= "strftime('%H', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  870.                            $NM_cmd_sum .= "strftime('%H', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  871.                        }
  872.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  873.                        {
  874.                            $NM_cmd     .= "extract(hour from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  875.                            $NM_cmd_sum .= "extract(hour from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  876.                        }
  877.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  878.                        {
  879.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  880.                            {
  881.                                $NM_cmd     .= "to_char (" $nome ", 'hh24') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  882.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'hh24') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  883.                            }
  884.                            else
  885.                            {
  886.                                $NM_cmd     .= $this->Ini_date_char "extract('hour' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  887.                                $NM_cmd_sum .= $this->Ini_date_char "extract('hour' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  888.                            }
  889.                        }
  890.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  891.                        {
  892.                            $NM_cmd     .= "extract(hour from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  893.                            $NM_cmd_sum .= "extract(hour from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  894.                        }
  895.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  896.                        {
  897.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'HH24')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  898.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'HH24')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  899.                        }
  900.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  901.                        {
  902.                            $NM_cmd     .= "DATEPART(hour, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  903.                            $NM_cmd_sum .= "DATEPART(hour, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  904.                        }
  905.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  906.                        {
  907.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  908.                            {
  909.                                $NM_cmd     .= "to_char (" $nome ", 'hh24') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  910.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'hh24') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  911.                            }
  912.                            else
  913.                            {
  914.                                $NM_cmd     .= "hour(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  915.                                $NM_cmd_sum .= "hour(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  916.                            }
  917.                        }
  918.                        else
  919.                        {
  920.                            $NM_cmd     .= "hour(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  921.                            $NM_cmd_sum .= "hour(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['hor'] . $this->End_date_part;
  922.                        }
  923.                    }
  924.                    if ($this->NM_data_qp['min'] != "__")
  925.                    {
  926.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  927.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_mint'] . " " $this->Lang_date_part " " $this->NM_data_qp['min'];
  928.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  929.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  930.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  931.                        {
  932.                            $NM_cmd     .= "strftime('%M', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  933.                            $NM_cmd_sum .= "strftime('%M', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  934.                        }
  935.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  936.                        {
  937.                            $NM_cmd     .= "extract(minute from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  938.                            $NM_cmd_sum .= "extract(minute from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  939.                        }
  940.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  941.                        {
  942.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  943.                            {
  944.                                $NM_cmd     .= "to_char (" $nome ", 'mi') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  945.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'mi') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  946.                            }
  947.                            else
  948.                            {
  949.                                $NM_cmd     .= $this->Ini_date_char "extract('minute' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  950.                                $NM_cmd_sum .= $this->Ini_date_char "extract('minute' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  951.                            }
  952.                        }
  953.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  954.                        {
  955.                            $NM_cmd     .= "extract(minute from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  956.                            $NM_cmd_sum .= "extract(minute from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  957.                        }
  958.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  959.                        {
  960.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'MI')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  961.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'MI')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  962.                        }
  963.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  964.                        {
  965.                            $NM_cmd     .= "DATEPART(minute, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  966.                            $NM_cmd_sum .= "DATEPART(minute, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  967.                        }
  968.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  969.                        {
  970.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  971.                            {
  972.                                $NM_cmd     .= "to_char (" $nome ", 'mi') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  973.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'mi') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  974.                            }
  975.                            else
  976.                            {
  977.                                $NM_cmd     .= "minute(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  978.                                $NM_cmd_sum .= "minute(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  979.                            }
  980.                        }
  981.                        else
  982.                        {
  983.                            $NM_cmd     .= "minute(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  984.                            $NM_cmd_sum .= "minute(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['min'] . $this->End_date_part;
  985.                        }
  986.                    }
  987.                    if ($this->NM_data_qp['seg'] != "__")
  988.                    {
  989.                        $NM_cond    .= (empty($NM_cmd)) ? "" " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " ";
  990.                        $NM_cond    .= $this->Ini->Nm_lang['lang_srch_scnd'] . " " $this->Lang_date_part " " $this->NM_data_qp['seg'];
  991.                        $NM_cmd     .= (empty($NM_cmd)) ? "" $concat;
  992.                        $NM_cmd_sum .= (empty($NM_cmd_sum)) ? "" $concat;
  993.                        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  994.                        {
  995.                            $NM_cmd     .= "strftime('%S', " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  996.                            $NM_cmd_sum .= "strftime('%S', " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  997.                        }
  998.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  999.                        {
  1000.                            $NM_cmd     .= "extract(second from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1001.                            $NM_cmd_sum .= "extract(second from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1002.                        }
  1003.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  1004.                        {
  1005.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  1006.                            {
  1007.                                $NM_cmd     .= "to_char (" $nome ", 'ss') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1008.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'ss') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1009.                            }
  1010.                            else
  1011.                            {
  1012.                                $NM_cmd     .= $this->Ini_date_char "extract('second' from " $nome ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1013.                                $NM_cmd_sum .= $this->Ini_date_char "extract('second' from " $nome_sum ")" $this->End_date_char $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1014.                            }
  1015.                        }
  1016.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
  1017.                        {
  1018.                            $NM_cmd     .= "extract(second from " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1019.                            $NM_cmd_sum .= "extract(second from " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1020.                        }
  1021.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  1022.                        {
  1023.                            $NM_cmd     .= "TO_CHAR(" $nome ", 'SS')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1024.                            $NM_cmd_sum .= "TO_CHAR(" $nome_sum ", 'SS')" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1025.                        }
  1026.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  1027.                        {
  1028.                            $NM_cmd     .= "DATEPART(second, " $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1029.                            $NM_cmd_sum .= "DATEPART(second, " $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1030.                        }
  1031.                        elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress))
  1032.                        {
  1033.                            if (trim($this->Operador_date_part) == "like" || trim($this->Operador_date_part) == "not like")
  1034.                            {
  1035.                                $NM_cmd     .= "to_char (" $nome ", 'ss') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1036.                                $NM_cmd_sum .= "to_char (" $nome_sum ", 'ss') " $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1037.                            }
  1038.                            else
  1039.                            {
  1040.                                $NM_cmd     .= "second(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1041.                                $NM_cmd_sum .= "second(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1042.                            }
  1043.                        }
  1044.                        else
  1045.                        {
  1046.                            $NM_cmd     .= "second(" $nome ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1047.                            $NM_cmd_sum .= "second(" $nome_sum ")" $this->Operador_date_part $this->Ini_date_part $this->NM_data_qp['seg'] . $this->End_date_part;
  1048.                        }
  1049.                    }
  1050.                }
  1051.                if ($this->Date_part)
  1052.                {
  1053.                    if (!empty($NM_cmd))
  1054.                    {
  1055.                        $NM_cmd     " (" $NM_cmd ")";
  1056.                        $NM_cmd_sum " (" $NM_cmd_sum ")";
  1057.                        $this->comando        .= $NM_cmd;
  1058.                        $this->comando_sum    .= $NM_cmd_sum;
  1059.                        $this->comando_filtro .= $NM_cmd;
  1060.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . ": " $NM_cond "##*@@";
  1061.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1062.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $NM_cond;
  1063.                        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $NM_cond;
  1064.                    }
  1065.                }
  1066.                else
  1067.                {
  1068.                    $this->comando        .= $nm_ini_lower $nome $nm_fim_lower $op_all "'%" $campo "%'";
  1069.                    $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower $op_all "'%" $campo "%'";
  1070.                    $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower $op_all "'%" $campo "%'";
  1071.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $lang_like " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1072.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1073.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $lang_like " " $this->cmp_formatado[$nome_campo];
  1074.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $lang_like " " $this->cmp_formatado[$nome_campo];
  1075.                }
  1076.             break;
  1077.             case "DF":     // 
  1078.                $this->comando        .= $nm_ini_lower $nome $nm_fim_lower " <> " $nm_aspas $campo $nm_aspas1;
  1079.                $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower " <> " $nm_aspas $campo $nm_aspas1;
  1080.                $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower " <> " $nm_aspas $campo $nm_aspas1;
  1081.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_diff'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1082.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1083.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_diff'] . " " $this->cmp_formatado[$nome_campo];
  1084.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_diff'] . " " $this->cmp_formatado[$nome_campo];
  1085.             break;
  1086.             case "GT":     // 
  1087.                $this->comando        .= $nome > " $nm_aspas $campo $nm_aspas1;
  1088.                $this->comando_sum    .= $nome_sum > " $nm_aspas $campo $nm_aspas1;
  1089.                $this->comando_filtro .= $nome > " $nm_aspas $campo $nm_aspas1;
  1090.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_grtr'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1091.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1092.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_grtr'] . " " $this->cmp_formatado[$nome_campo];
  1093.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_grtr'] . " " $this->cmp_formatado[$nome_campo];
  1094.             break;
  1095.             case "GE":     // 
  1096.                $this->comando        .= $nome >= " $nm_aspas $campo $nm_aspas1;
  1097.                $this->comando_sum    .= $nome_sum >= " $nm_aspas $campo $nm_aspas1;
  1098.                $this->comando_filtro .= $nome >= " $nm_aspas $campo $nm_aspas1;
  1099.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_grtr_equl'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1100.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1101.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_grtr_equl'] . " " $this->cmp_formatado[$nome_campo];
  1102.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_grtr_equl'] . " " $this->cmp_formatado[$nome_campo];
  1103.             break;
  1104.             case "LT":     // 
  1105.                $this->comando        .= $nome < " $nm_aspas $campo $nm_aspas1;
  1106.                $this->comando_sum    .= $nome_sum < " $nm_aspas $campo $nm_aspas1;
  1107.                $this->comando_filtro .= $nome < " $nm_aspas $campo $nm_aspas1;
  1108.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_less'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1109.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1110.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_less'] . " " $this->cmp_formatado[$nome_campo];
  1111.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_less'] . " " $this->cmp_formatado[$nome_campo];
  1112.             break;
  1113.             case "LE":     // 
  1114.                $this->comando        .= $nome <= " $nm_aspas $campo $nm_aspas1;
  1115.                $this->comando_sum    .= $nome_sum <= " $nm_aspas $campo $nm_aspas1;
  1116.                $this->comando_filtro .= $nome <= " $nm_aspas $campo $nm_aspas1;
  1117.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_less_equl'] . " " $this->cmp_formatado[$nome_campo] . "##*@@";
  1118.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1119.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_less_equl'] . " " $this->cmp_formatado[$nome_campo];
  1120.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_less_equl'] . " " $this->cmp_formatado[$nome_campo];
  1121.             break;
  1122.             case "BW":     // 
  1123.                $this->comando        .= $nome between " $nm_aspas $campo $nm_aspas1 " and " $nm_aspas $campo2 $nm_aspas1;
  1124.                $this->comando_sum    .= $nome_sum between " $nm_aspas $campo $nm_aspas1 " and " $nm_aspas $campo2 $nm_aspas1;
  1125.                $this->comando_filtro .= $nome between " $nm_aspas $campo $nm_aspas1 " and " $nm_aspas $campo2 $nm_aspas1;
  1126.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_betw'] . " " $this->cmp_formatado[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " " $this->cmp_formatado[$nome_campo "_input_2"] . "##*@@";
  1127.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1128.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_betw'] . " " $this->cmp_formatado[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " " $this->cmp_formatado[$nome_campo "_input_2"];
  1129.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_betw'] . " " $this->cmp_formatado[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_and_cond'] . " " $this->cmp_formatado[$nome_campo "_input_2"];
  1130.             break;
  1131.             case "IN":     // 
  1132.                $nm_sc_valores explode(","$campo);
  1133.                $cond_str  "";
  1134.                $nm_cond   "";
  1135.                $cond_descr  "";
  1136.                $count_descr 0;
  1137.                $end_descr   false;
  1138.                $lim_descr   15;
  1139.                $lang_descr  strlen($this->Ini->Nm_lang['lang_srch_orr_cond']);
  1140.                if (!empty($nm_sc_valores))
  1141.                {
  1142.                    foreach ($nm_sc_valores as $nm_sc_valor)
  1143.                    {
  1144.                       if (in_array($campo_join$Nm_numeric) && substr_count($nm_sc_valor".") > 1)
  1145.                       {
  1146.                          $nm_sc_valor str_replace("."""$nm_sc_valor);
  1147.                       }
  1148.                       if ("" != $cond_str)
  1149.                       {
  1150.                          $cond_str .= ",";
  1151.                          $nm_cond  .= " " $this->Ini->Nm_lang['lang_srch_orr_cond'] . " ";
  1152.                       }
  1153.                       $cond_str .= $nm_aspas $nm_sc_valor $nm_aspas1;
  1154.                       $nm_cond  .= $nm_aspas $nm_sc_valor $nm_aspas1;
  1155.                       if (((strlen($cond_descr) + strlen($nm_sc_valor) + $lang_descr) < $lim_descr) || empty($cond_descr))
  1156.                       {
  1157.                           $cond_descr .= (empty($cond_descr)) ? "" " " $this->Ini->Nm_lang['lang_srch_orr_cond'] . " ";
  1158.                           $cond_descr .= $nm_aspas $nm_sc_valor $nm_aspas1;
  1159.                           $count_descr++;
  1160.                       }
  1161.                       elseif (!$end_descr)
  1162.                       {
  1163.                           $cond_descr .= " +" . (count($nm_sc_valores) - $count_descr);
  1164.                           $end_descr true;
  1165.                       };
  1166.                    }
  1167.                }
  1168.                $this->comando        .= $nm_ini_lower $nome $nm_fim_lower " in (" $cond_str ")";
  1169.                $this->comando_sum    .= $nm_ini_lower $nome_sum $nm_fim_lower " in (" $cond_str ")";
  1170.                $this->comando_filtro .= $nm_ini_lower $nome $nm_fim_lower " in (" $cond_str ")";
  1171.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_like'] . " " $nm_cond "##*@@";
  1172.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1173.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_like'] . " " $cond_descr;
  1174.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_like'] . " " $nm_cond;
  1175.             break;
  1176.             case "NU":     // 
  1177.                $this->comando        .= $nome IS NULL ";
  1178.                $this->comando_sum    .= $nome_sum IS NULL ";
  1179.                $this->comando_filtro .= $nome IS NULL ";
  1180.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_null'] . "##*@@";
  1181.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1182.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_null'];
  1183.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_null'];
  1184.             break;
  1185.             case "NN":     // 
  1186.                $this->comando        .= $nome IS NOT NULL ";
  1187.                $this->comando_sum    .= $nome_sum IS NOT NULL ";
  1188.                $this->comando_filtro .= $nome IS NOT NULL ";
  1189.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_nnul'] . "##*@@";
  1190.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1191.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_nnul'];
  1192.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_nnul'];
  1193.             break;
  1194.             case "EP":     // 
  1195.                $this->comando        .= $nome = '' ";
  1196.                $this->comando_sum    .= $nome_sum = '' ";
  1197.                $this->comando_filtro .= $nome = '' ";
  1198.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_empty'] . "##*@@";
  1199.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1200.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_empty'];
  1201.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_empty'];
  1202.             break;
  1203.             case "NE":     // 
  1204.                $this->comando        .= $nome <> '' ";
  1205.                $this->comando_sum    .= $nome_sum <> '' ";
  1206.                $this->comando_filtro .= $nome <> '' ";
  1207.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $nmgp_tab_label[$nome_campo] . " " $this->Ini->Nm_lang['lang_srch_nempty'] . "##*@@";
  1208.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['label'] = $nmgp_tab_label[$nome_campo];
  1209.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['descr'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_nempty'];
  1210.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$nome_campo]['hint'] = $nmgp_tab_label[$nome_campo] . ": " $this->Ini->Nm_lang['lang_srch_nempty'];
  1211.             break;
  1212.          }
  1213.       }
  1214.    }

  1215.    function nm_prep_date(&$val$tp$tsql, &$cond$format_nd$tp_nd)
  1216.    {
  1217.        $fill_dt false;
  1218.        if ($tsql == "TIMESTAMP")
  1219.        {
  1220.            $tsql "DATETIME";
  1221.        }
  1222.        $cond strtoupper($cond);
  1223.        if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access) && $tp != "ND")
  1224.        {
  1225.            if ($cond == "EP")
  1226.            {
  1227.                $cond "NU";
  1228.            }
  1229.            if ($cond == "NE")
  1230.            {
  1231.                $cond "NN";
  1232.            }
  1233.        }
  1234.        if ($cond == "NU" || $cond == "NN" || $cond == "EP" || $cond == "NE")
  1235.        {
  1236.            $val    = array();
  1237.            $val[0] = "";
  1238.            return;
  1239.        }
  1240.        if ($cond != "II" && $cond != "QP" && $cond != "NP")
  1241.        {
  1242.            $fill_dt true;
  1243.        }
  1244.        if ($fill_dt)
  1245.        {
  1246.            $val[0]['dia'] = (!empty($val[0]['dia']) && strlen($val[0]['dia']) == 1) ? "0" $val[0]['dia'] : $val[0]['dia'];
  1247.            $val[0]['mes'] = (!empty($val[0]['mes']) && strlen($val[0]['mes']) == 1) ? "0" $val[0]['mes'] : $val[0]['mes'];
  1248.            if ($tp == "DH")
  1249.            {
  1250.                $val[0]['hor'] = (!empty($val[0]['hor']) && strlen($val[0]['hor']) == 1) ? "0" $val[0]['hor'] : $val[0]['hor'];
  1251.                $val[0]['min'] = (!empty($val[0]['min']) && strlen($val[0]['min']) == 1) ? "0" $val[0]['min'] : $val[0]['min'];
  1252.                $val[0]['seg'] = (!empty($val[0]['seg']) && strlen($val[0]['seg']) == 1) ? "0" $val[0]['seg'] : $val[0]['seg'];
  1253.            }
  1254.            if ($cond == "BW")
  1255.            {
  1256.                $val[1]['dia'] = (!empty($val[1]['dia']) && strlen($val[1]['dia']) == 1) ? "0" $val[1]['dia'] : $val[1]['dia'];
  1257.                $val[1]['mes'] = (!empty($val[1]['mes']) && strlen($val[1]['mes']) == 1) ? "0" $val[1]['mes'] : $val[1]['mes'];
  1258.                if ($tp == "DH")
  1259.                {
  1260.                    $val[1]['hor'] = (!empty($val[1]['hor']) && strlen($val[1]['hor']) == 1) ? "0" $val[1]['hor'] : $val[1]['hor'];
  1261.                    $val[1]['min'] = (!empty($val[1]['min']) && strlen($val[1]['min']) == 1) ? "0" $val[1]['min'] : $val[1]['min'];
  1262.                    $val[1]['seg'] = (!empty($val[1]['seg']) && strlen($val[1]['seg']) == 1) ? "0" $val[1]['seg'] : $val[1]['seg'];
  1263.                }
  1264.            }
  1265.        }
  1266.        if ($cond == "BW")
  1267.        {
  1268.            $this->NM_data_1 = array();
  1269.            $this->NM_data_1['ano'] = (isset($val[0]['ano']) && !empty($val[0]['ano'])) ? $val[0]['ano'] : "____";
  1270.            $this->NM_data_1['mes'] = (isset($val[0]['mes']) && !empty($val[0]['mes'])) ? $val[0]['mes'] : "__";
  1271.            $this->NM_data_1['dia'] = (isset($val[0]['dia']) && !empty($val[0]['dia'])) ? $val[0]['dia'] : "__";
  1272.            $this->NM_data_1['hor'] = (isset($val[0]['hor']) && !empty($val[0]['hor'])) ? $val[0]['hor'] : "__";
  1273.            $this->NM_data_1['min'] = (isset($val[0]['min']) && !empty($val[0]['min'])) ? $val[0]['min'] : "__";
  1274.            $this->NM_data_1['seg'] = (isset($val[0]['seg']) && !empty($val[0]['seg'])) ? $val[0]['seg'] : "__";
  1275.            $this->data_menor($this->NM_data_1);
  1276.            $this->NM_data_2 = array();
  1277.            $this->NM_data_2['ano'] = (isset($val[1]['ano']) && !empty($val[1]['ano'])) ? $val[1]['ano'] : "____";
  1278.            $this->NM_data_2['mes'] = (isset($val[1]['mes']) && !empty($val[1]['mes'])) ? $val[1]['mes'] : "__";
  1279.            $this->NM_data_2['dia'] = (isset($val[1]['dia']) && !empty($val[1]['dia'])) ? $val[1]['dia'] : "__";
  1280.            $this->NM_data_2['hor'] = (isset($val[1]['hor']) && !empty($val[1]['hor'])) ? $val[1]['hor'] : "__";
  1281.            $this->NM_data_2['min'] = (isset($val[1]['min']) && !empty($val[1]['min'])) ? $val[1]['min'] : "__";
  1282.            $this->NM_data_2['seg'] = (isset($val[1]['seg']) && !empty($val[1]['seg'])) ? $val[1]['seg'] : "__";
  1283.            $this->data_maior($this->NM_data_2);
  1284.            $val = array();
  1285.            if ($tp == "ND")
  1286.            {
  1287.                $out_dt1 $format_nd;
  1288.                $out_dt1 str_replace("yyyy"$this->NM_data_1['ano'], $out_dt1);
  1289.                $out_dt1 str_replace("mm",   $this->NM_data_1['mes'], $out_dt1);
  1290.                $out_dt1 str_replace("dd",   $this->NM_data_1['dia'], $out_dt1);
  1291.                $out_dt1 str_replace("hh",   ""$out_dt1);
  1292.                $out_dt1 str_replace("ii",   ""$out_dt1);
  1293.                $out_dt1 str_replace("ss",   ""$out_dt1);
  1294.                $out_dt2 $format_nd;
  1295.                $out_dt2 str_replace("yyyy"$this->NM_data_2['ano'], $out_dt2);
  1296.                $out_dt2 str_replace("mm",   $this->NM_data_2['mes'], $out_dt2);
  1297.                $out_dt2 str_replace("dd",   $this->NM_data_2['dia'], $out_dt2);
  1298.                $out_dt2 str_replace("hh",   ""$out_dt2);
  1299.                $out_dt2 str_replace("ii",   ""$out_dt2);
  1300.                $out_dt2 str_replace("ss",   ""$out_dt2);
  1301.                $val[0] = $out_dt1;
  1302.                $val[1] = $out_dt2;
  1303.                return;
  1304.            }
  1305.            if ($tsql == "TIME")
  1306.            {
  1307.                $val[0] = $this->NM_data_1['hor'] . ":" $this->NM_data_1['min'] . ":" $this->NM_data_1['seg'];
  1308.                $val[1] = $this->NM_data_2['hor'] . ":" $this->NM_data_2['min'] . ":" $this->NM_data_2['seg'];
  1309.            }
  1310.            elseif (substr($tsql04) == "DATE")
  1311.            {
  1312.                $val[0] = $this->NM_data_1['ano'] . "-" $this->NM_data_1['mes'] . "-" $this->NM_data_1['dia'];
  1313.                $val[1] = $this->NM_data_2['ano'] . "-" $this->NM_data_2['mes'] . "-" $this->NM_data_2['dia'];
  1314.                if (strpos($tsql"TIME") !== false)
  1315.                {
  1316.                    $val[0] .= " " $this->NM_data_1['hor'] . ":" $this->NM_data_1['min'] . ":" $this->NM_data_1['seg'];
  1317.                    $val[1] .= " " $this->NM_data_2['hor'] . ":" $this->NM_data_2['min'] . ":" $this->NM_data_2['seg'];
  1318.                }
  1319.            }
  1320.            return;
  1321.        }
  1322.        $this->NM_data_qp = array();
  1323.        $this->NM_data_qp['ano'] = (isset($val[0]['ano']) && $val[0]['ano'] != "") ? $val[0]['ano'] : "____";
  1324.        $this->NM_data_qp['mes'] = (isset($val[0]['mes']) && $val[0]['mes'] != "") ? $val[0]['mes'] : "__";
  1325.        $this->NM_data_qp['dia'] = (isset($val[0]['dia']) && $val[0]['dia'] != "") ? $val[0]['dia'] : "__";
  1326.        $this->NM_data_qp['hor'] = (isset($val[0]['hor']) && $val[0]['hor'] != "") ? $val[0]['hor'] : "__";
  1327.        $this->NM_data_qp['min'] = (isset($val[0]['min']) && $val[0]['min'] != "") ? $val[0]['min'] : "__";
  1328.        $this->NM_data_qp['seg'] = (isset($val[0]['seg']) && $val[0]['seg'] != "") ? $val[0]['seg'] : "__";
  1329.        if ($tp != "ND" && ($cond == "LE" || $cond == "LT" || $cond == "GE" || $cond == "GT"))
  1330.        {
  1331.            $count_fill 0;
  1332.            foreach ($this->NM_data_qp as $x => $tx)
  1333.            {
  1334.                if (substr($tx02) != "__")
  1335.                {
  1336.                    $count_fill++;
  1337.                }
  1338.            }
  1339.            if ($count_fill 1)
  1340.            {
  1341.                if ($cond == "LE" || $cond == "GT")
  1342.                {
  1343.                    $this->data_maior($this->NM_data_qp);
  1344.                }
  1345.                else
  1346.                {
  1347.                    $this->data_menor($this->NM_data_qp);
  1348.                }
  1349.                if ($tsql == "TIME")
  1350.                {
  1351.                    $val[0] = $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1352.                }
  1353.                elseif (substr($tsql04) == "DATE")
  1354.                {
  1355.                    $val[0] = $this->NM_data_qp['ano'] . "-" $this->NM_data_qp['mes'] . "-" $this->NM_data_qp['dia'];
  1356.                    if (strpos($tsql"TIME") !== false)
  1357.                    {
  1358.                        $val[0] .= " " $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1359.                    }
  1360.                }
  1361.                return;
  1362.            }
  1363.        }
  1364.        foreach ($this->NM_data_qp as $x => $tx)
  1365.        {
  1366.            if (substr($tx02) == "__" && ($x == "dia" || $x == "mes" || $x == "ano"))
  1367.            {
  1368.                if (substr($tsql04) == "DATE")
  1369.                {
  1370.                    $this->Date_part true;
  1371.                    break;
  1372.                }
  1373.            }
  1374.            if (substr($tx02) == "__" && ($x == "hor" || $x == "min" || $x == "seg"))
  1375.            {
  1376.                if (strpos($tsql"TIME") !== false && ($tp == "DH" || ($tp == "DT" && $cond != "LE" && $cond != "LT" && $cond != "GE" && $cond != "GT")))
  1377.                {
  1378.                    $this->Date_part true;
  1379.                    break;
  1380.                }
  1381.            }
  1382.        }
  1383.        if ($this->Date_part)
  1384.        {
  1385.            $this->Ini_date_part "";
  1386.            $this->End_date_part "";
  1387.            $this->Ini_date_char "";
  1388.            $this->End_date_char "";
  1389.            if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
  1390.            {
  1391.                $this->Ini_date_part "'";
  1392.                $this->End_date_part "'";
  1393.            }
  1394.            if ($tp != "ND")
  1395.            {
  1396.                if ($cond == "EQ")
  1397.                {
  1398.                    $this->Operador_date_part " = ";
  1399.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_equl'];
  1400.                }
  1401.                elseif ($cond == "II")
  1402.                {
  1403.                    $this->Operador_date_part " like ";
  1404.                    $this->Ini_date_part "'";
  1405.                    $this->End_date_part "%'";
  1406.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_strt'];
  1407.                    if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  1408.                    {
  1409.                        $this->Ini_date_char "CAST (";
  1410.                        $this->End_date_char " AS TEXT)";
  1411.                    }
  1412.                }
  1413.                elseif ($cond == "DF")
  1414.                {
  1415.                    $this->Operador_date_part " <> ";
  1416.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_diff'];
  1417.                }
  1418.                elseif ($cond == "GT")
  1419.                {
  1420.                    $this->Operador_date_part " > ";
  1421.                    $this->Lang_date_part $this->Ini->Nm_lang['pesq_cond_maior'];
  1422.                }
  1423.                elseif ($cond == "GE")
  1424.                {
  1425.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_grtr_equl'];
  1426.                    $this->Operador_date_part " >= ";
  1427.                }
  1428.                elseif ($cond == "LT")
  1429.                {
  1430.                    $this->Operador_date_part " < ";
  1431.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_less'];
  1432.                }
  1433.                elseif ($cond == "LE")
  1434.                {
  1435.                    $this->Operador_date_part " <= ";
  1436.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_less_equl'];
  1437.                }
  1438.                elseif ($cond == "NP")
  1439.                {
  1440.                    $this->Operador_date_part " not like ";
  1441.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_diff'];
  1442.                    $this->Ini_date_part "'%";
  1443.                    $this->End_date_part "%'";
  1444.                    if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  1445.                    {
  1446.                        $this->Ini_date_char "CAST (";
  1447.                        $this->End_date_char " AS TEXT)";
  1448.                    }
  1449.                }
  1450.                else
  1451.                {
  1452.                    $this->Operador_date_part " like ";
  1453.                    $this->Lang_date_part $this->Ini->Nm_lang['lang_srch_equl'];
  1454.                    $this->Ini_date_part "'%";
  1455.                    $this->End_date_part "%'";
  1456.                    if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  1457.                    {
  1458.                        $this->Ini_date_char "CAST (";
  1459.                        $this->End_date_char " AS TEXT)";
  1460.                    }
  1461.                }
  1462.            }
  1463.            if ($cond == "DF")
  1464.            {
  1465.                $cond "NP";
  1466.            }
  1467.            if ($cond != "NP")
  1468.            {
  1469.                $cond "QP";
  1470.            }
  1471.        }
  1472.        $val = array();
  1473.        if ($tp != "ND" && ($cond == "QP" || $cond == "NP"))
  1474.        {
  1475.            $val[0] = "";
  1476.            if (substr($tsql04) == "DATE")
  1477.            {
  1478.                $val[0] .= $this->NM_data_qp['ano'] . "-" $this->NM_data_qp['mes'] . "-" $this->NM_data_qp['dia'];
  1479.                if (strpos($tsql"TIME") !== false)
  1480.                {
  1481.                    $val[0] .= " ";
  1482.                }
  1483.            }
  1484.            if (strpos($tsql"TIME") !== false)
  1485.            {
  1486.                $val[0] .= $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1487.            }
  1488.            return;
  1489.        }
  1490.        if ($cond == "II" || $cond == "DF" || $cond == "EQ" || $cond == "LT" || $cond == "GE")
  1491.        {
  1492.            $this->data_menor($this->NM_data_qp);
  1493.        }
  1494.        else
  1495.        {
  1496.            $this->data_maior($this->NM_data_qp);
  1497.        }
  1498.        if ($tsql == "TIME")
  1499.        {
  1500.            $val[0] = $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1501.            return;
  1502.        }
  1503.        $format_sql "";
  1504.        if (substr($tsql04) == "DATE")
  1505.        {
  1506.            $format_sql .= $this->NM_data_qp['ano'] . "-" $this->NM_data_qp['mes'] . "-" $this->NM_data_qp['dia'];
  1507.            if (strpos($tsql"TIME") !== false)
  1508.            {
  1509.                $format_sql .= " ";
  1510.            }
  1511.        }
  1512.        if (strpos($tsql"TIME") !== false)
  1513.        {
  1514.            $format_sql .=  $this->NM_data_qp['hor'] . ":" $this->NM_data_qp['min'] . ":" $this->NM_data_qp['seg'];
  1515.        }
  1516.        if ($tp != "ND")
  1517.        {
  1518.            $val[0] = $format_sql;
  1519.            return;
  1520.        }
  1521.        if ($tp == "ND")
  1522.        {
  1523.            $format_nd str_replace("yyyy"$this->NM_data_qp['ano'], $format_nd);
  1524.            $format_nd str_replace("mm",   $this->NM_data_qp['mes'], $format_nd);
  1525.            $format_nd str_replace("dd",   $this->NM_data_qp['dia'], $format_nd);
  1526.            $format_nd str_replace("hh",   $this->NM_data_qp['hor'], $format_nd);
  1527.            $format_nd str_replace("ii",   $this->NM_data_qp['min'], $format_nd);
  1528.            $format_nd str_replace("ss",   $this->NM_data_qp['seg'], $format_nd);
  1529.            $val[0] = $format_nd;
  1530.            return;
  1531.        }
  1532.    }
  1533.    function data_menor(&$data_arr)
  1534.    {
  1535.        $data_arr["ano"] = ("____" == $data_arr["ano"]) ? "0001" $data_arr["ano"];
  1536.        $data_arr["mes"] = ("__" == $data_arr["mes"])   ? "01" $data_arr["mes"];
  1537.        $data_arr["dia"] = ("__" == $data_arr["dia"])   ? "01" $data_arr["dia"];
  1538.        $data_arr["hor"] = ("__" == $data_arr["hor"])   ? "00" $data_arr["hor"];
  1539.        $data_arr["min"] = ("__" == $data_arr["min"])   ? "00" $data_arr["min"];
  1540.        $data_arr["seg"] = ("__" == $data_arr["seg"])   ? "00" $data_arr["seg"];
  1541.    }

  1542.    function data_maior(&$data_arr)
  1543.    {
  1544.        $data_arr["ano"] = ("____" == $data_arr["ano"]) ? "9999" $data_arr["ano"];
  1545.        $data_arr["mes"] = ("__" == $data_arr["mes"])   ? "12" $data_arr["mes"];
  1546.        $data_arr["hor"] = ("__" == $data_arr["hor"])   ? "23" $data_arr["hor"];
  1547.        $data_arr["min"] = ("__" == $data_arr["min"])   ? "59" $data_arr["min"];
  1548.        $data_arr["seg"] = ("__" == $data_arr["seg"])   ? "59" $data_arr["seg"];
  1549.        if ("__" == $data_arr["dia"])
  1550.        {
  1551.            $data_arr["dia"] = "31";
  1552.            if ($data_arr["mes"] == "04" || $data_arr["mes"] == "06" || $data_arr["mes"] == "09" || $data_arr["mes"] == "11")
  1553.            {
  1554.                $data_arr["dia"] = 30;
  1555.            }
  1556.            elseif ($data_arr["mes"] == "02")
  1557.            { 
  1558.                 if  ($data_arr["ano"] % == 0)
  1559.                 {
  1560.                      $data_arr["dia"] = 29;
  1561.                 }
  1562.                 else 
  1563.                 {
  1564.                      $data_arr["dia"] = 28;
  1565.                 }
  1566.            }
  1567.        }
  1568.    }

  1569.    /**
  1570.     * @access  public
  1571.     * @param  string  $nm_data_hora  
  1572.     */
  1573.    function limpa_dt_hor_pesq(&$nm_data_hora)
  1574.    {
  1575.       $nm_data_hora str_replace("Y"""$nm_data_hora); 
  1576.       $nm_data_hora str_replace("M"""$nm_data_hora); 
  1577.       $nm_data_hora str_replace("D"""$nm_data_hora); 
  1578.       $nm_data_hora str_replace("H"""$nm_data_hora); 
  1579.       $nm_data_hora str_replace("I"""$nm_data_hora); 
  1580.       $nm_data_hora str_replace("S"""$nm_data_hora); 
  1581.       $tmp_pos strpos($nm_data_hora"--");
  1582.       if ($tmp_pos !== FALSE)
  1583.       {
  1584.           $nm_data_hora str_replace("--""-"$nm_data_hora); 
  1585.       }
  1586.       $tmp_pos strpos($nm_data_hora"::");
  1587.       if ($tmp_pos !== FALSE)
  1588.       {
  1589.           $nm_data_hora str_replace("::"":"$nm_data_hora); 
  1590.       }
  1591.    }

  1592.    /**
  1593.     * @access  public
  1594.     */
  1595.    function retorna_pesq()
  1596.    {
  1597.       global $nm_apl_dependente;
  1598.    $NM_retorno "./";
  1599. ?>
  1600. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  1601.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  1602. <HTML>
  1603. <HEAD>
  1604.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_srch_title'?> </TITLE>
  1605.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  1606. <?php
  1607. if ($_SESSION['scriptcase']['proc_mobile'])
  1608. {
  1609. ?>
  1610.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  1611. <?php
  1612. }
  1613. ?>
  1614.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  1615.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  1616.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  1617.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  1618.  <META http-equiv="Pragma" content="no-cache"/>
  1619.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  1620. </HEAD>
  1621. <BODY class="scGridPage">
  1622. <FORM style="display:none;" name="form_ok" method="POST" action="<?php echo $NM_retorno?>" target="_self">
  1623. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  1624. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  1625. <INPUT type="hidden" name="nmgp_opcao" value="pesq"> 
  1626. </FORM>
  1627. <SCRIPT type="text/javascript">
  1628.  document.form_ok.submit();
  1629. </SCRIPT>
  1630. </BODY>
  1631. </HTML>
  1632. <?php
  1633. }

  1634.    /**
  1635.     * @access  public
  1636.     */
  1637.    function monta_html_ini()
  1638.    {
  1639. ?>
  1640. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  1641.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  1642. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  1643. <HEAD>
  1644.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_srch_title'?> </TITLE>
  1645.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  1646. <?php
  1647. if ($_SESSION['scriptcase']['proc_mobile'])
  1648. {
  1649. ?>
  1650.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  1651. <?php
  1652. }
  1653. ?>
  1654.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  1655.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  1656.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  1657.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  1658.  <META http-equiv="Pragma" content="no-cache"/>
  1659.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  1660.  <script type="text/javascript" src="<?php echo $this->Ini->path_prod ?>/third/jquery/js/jquery.js"></script>
  1661.  <script type="text/javascript" src="<?php echo $this->Ini->path_prod?>/third/jquery/js/jquery-ui.js"></script>
  1662.  <script type="text/javascript" src="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/malsup-blockui/jquery.blockUI.js"></script>
  1663.  <script type="text/javascript" src="../_lib/lib/js/scInput.js"></script>
  1664.  <script type="text/javascript" src="../_lib/lib/js/jquery.scInput.js"></script>
  1665.  <script type="text/javascript" src="../_lib/lib/js/jquery.scInput2.js"></script>
  1666.  <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/thickbox.css" type="text/css" media="screen" />
  1667.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_error.css" /> 
  1668.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_error<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  1669.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Str_btn_filter_css ?>" /> 
  1670.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_form.css" /> 
  1671.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_form<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  1672.  <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/jquery/css/smoothness/jquery-ui.css" type="text/css" media="screen" />
  1673.  <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/font-awesome/css/all.min.css" type="text/css" media="screen" />
  1674.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_filter.css" /> 
  1675.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_filter<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  1676.   <?php 
  1677.   if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts)) 
  1678.   { 
  1679.   ?> 
  1680.   <link href="<?php echo $this->Ini->str_google_fonts ?>" rel="stylesheet" /> 
  1681.   <?php 
  1682.   } 
  1683.   ?> 
  1684.  <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->path_link ?>grid_new/grid_new_fil_<?php echo strtolower($_SESSION['scriptcase']['reg_conf']['css_dir']) ?>.css" />
  1685. </HEAD>
  1686. <BODY class="scFilterPage">
  1687. <?php echo $this->Ini->Ajax_result_set ?>
  1688. <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_js "/browserSniffer.js" ?>"></SCRIPT>
  1689.    <script type="text/javascript">
  1690.      var applicationKeys = '';
  1691.      applicationKeys += 'ctrl+k';
  1692.      applicationKeys += ',';
  1693.      applicationKeys += 'ctrl+enter';
  1694.      applicationKeys += ',';
  1695.      applicationKeys += 'ctrl+e';
  1696.      applicationKeys += ',';
  1697.      applicationKeys += 'f1';
  1698.      applicationKeys += ',';
  1699.      applicationKeys += 'alt+q';
  1700.      var hotkeyList = '';
  1701.      function execHotKey(e, h) {
  1702.          var hotkey_fired = false
  1703.          switch (true) {
  1704.              case (['ctrl+k'].indexOf(h.key) > -1):
  1705.                  hotkey_fired = process_hotkeys('sys_format_lim');
  1706.                  break;
  1707.              case (['ctrl+enter'].indexOf(h.key) > -1):
  1708.                  hotkey_fired = process_hotkeys('sys_format_fi2');
  1709.                  break;
  1710.              case (['ctrl+e'].indexOf(h.key) > -1):
  1711.                  hotkey_fired = process_hotkeys('sys_format_edi');
  1712.                  break;
  1713.              case (['f1'].indexOf(h.key) > -1):
  1714.                  hotkey_fired = process_hotkeys('sys_format_webh');
  1715.                  break;
  1716.              case (['alt+q'].indexOf(h.key) > -1):
  1717.                  hotkey_fired = process_hotkeys('sys_format_sai');
  1718.                  break;
  1719.          }
  1720.          if (hotkey_fired) {
  1721.              e.preventDefault();
  1722.              return false;
  1723.          } else {
  1724.              return true;
  1725.          }
  1726.      }
  1727.    </script>
  1728.    <script type="text/javascript" src="../_lib/lib/js/hotkeys.inc.js"></script>
  1729.    <script type="text/javascript" src="../_lib/lib/js/hotkeys_setup.js"></script>
  1730.         <script type="text/javascript">
  1731.           var sc_pathToTB = '<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/';
  1732.           var sc_tbLangClose = "<?php echo html_entity_decode($this->Ini->Nm_lang['lang_tb_close'], ENT_COMPAT$_SESSION['scriptcase']['charset']) ?>";
  1733.           var sc_tbLangEsc = "<?php echo html_entity_decode($this->Ini->Nm_lang['lang_tb_esc'], ENT_COMPAT$_SESSION['scriptcase']['charset']) ?>";
  1734.         </script>
  1735.  <script type="text/javascript" src="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/thickbox-compressed.js"></script>
  1736.  <script type="text/javascript" src="grid_new_ajax_search.js"></script>
  1737.  <script type="text/javascript" src="grid_new_ajax.js"></script>
  1738.  <script type="text/javascript">
  1739.    function sc_session_redir(url_redir)
  1740.    {
  1741.        if (window.parent && window.parent.document != window.document && typeof window.parent.sc_session_redir === 'function')
  1742.        {
  1743.            window.parent.sc_session_redir(url_redir);
  1744.        }
  1745.        else
  1746.        {
  1747.            if (window.opener && typeof window.opener.sc_session_redir === 'function')
  1748.            {
  1749.                window.close();
  1750.                window.opener.sc_session_redir(url_redir);
  1751.            }
  1752.            else
  1753.            {
  1754.                window.location = url_redir;
  1755.            }
  1756.        }
  1757.    }
  1758.    var sc_ajaxBg = '<?php echo $this->Ini->Color_bg_ajax ?>';
  1759.    var sc_ajaxBordC = '<?php echo $this->Ini->Border_c_ajax ?>';
  1760.    var sc_ajaxBordS = '<?php echo $this->Ini->Border_s_ajax ?>';
  1761.    var sc_ajaxBordW = '<?php echo $this->Ini->Border_w_ajax ?>';
  1762.  </script>
  1763. <?php
  1764. $Cod_Btn nmButtonOutput($this->arr_buttons"berrm_clse""nmAjaxHideDebug()""nmAjaxHideDebug()"""""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  1765. ?>
  1766. <div id="id_debug_window" style="display: none; position: absolute; left: 50px; top: 50px"><table class="scFormMessageTable">
  1767. <tr><td class="scFormMessageTitle"><?php echo $Cod_Btn ?>&nbsp;&nbsp;Output</td></tr>
  1768. <tr><td class="scFormMessageMessage" style="padding: 0px; vertical-align: top"><div style="padding: 2px; height: 200px; width: 350px; overflow: auto" id="id_debug_text"></div></td></tr>
  1769. </table></div>
  1770. <script type="text/javascript" src="grid_new_message.js"></script>
  1771. <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_filter ?>_sweetalert.css" />
  1772. <script type="text/javascript" src="<?php echo $_SESSION['scriptcase']['grid_new']['glo_nm_path_prod']; ?>/third/sweetalert/sweetalert2.all.min.js"></script>
  1773. <script type="text/javascript" src="<?php echo $_SESSION['scriptcase']['grid_new']['glo_nm_path_prod']; ?>/third/sweetalert/polyfill.min.js"></script>
  1774. <script type="text/javascript" src="../_lib/lib/js/frameControl.js"></script>
  1775. <?php
  1776. $confirmButtonClass '';
  1777. $cancelButtonClass  '';
  1778. $confirmButtonText  $this->Ini->Nm_lang['lang_btns_cfrm'];
  1779. $cancelButtonText   $this->Ini->Nm_lang['lang_btns_cncl'];
  1780. $confirmButtonFA    '';
  1781. $cancelButtonFA     '';
  1782. $confirmButtonFAPos '';
  1783. $cancelButtonFAPos  '';
  1784. if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['style']) && '' != $this->arr_buttons['bsweetalert_ok']['style']) {
  1785.     $confirmButtonClass 'scButton_' $this->arr_buttons['bsweetalert_ok']['style'];
  1786. }
  1787. if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['style']) && '' != $this->arr_buttons['bsweetalert_cancel']['style']) {
  1788.     $cancelButtonClass 'scButton_' $this->arr_buttons['bsweetalert_cancel']['style'];
  1789. }
  1790. if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['value']) && '' != $this->arr_buttons['bsweetalert_ok']['value']) {
  1791.     $confirmButtonText $this->arr_buttons['bsweetalert_ok']['value'];
  1792. }
  1793. if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['value']) && '' != $this->arr_buttons['bsweetalert_cancel']['value']) {
  1794.     $cancelButtonText $this->arr_buttons['bsweetalert_cancel']['value'];
  1795. }
  1796. if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['fontawesomeicon']) && '' != $this->arr_buttons['bsweetalert_ok']['fontawesomeicon']) {
  1797.     $confirmButtonFA $this->arr_buttons['bsweetalert_ok']['fontawesomeicon'];
  1798. }
  1799. if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['fontawesomeicon']) && '' != $this->arr_buttons['bsweetalert_cancel']['fontawesomeicon']) {
  1800.     $cancelButtonFA $this->arr_buttons['bsweetalert_cancel']['fontawesomeicon'];
  1801. }
  1802. if (isset($this->arr_buttons['bsweetalert_ok']) && isset($this->arr_buttons['bsweetalert_ok']['display_position']) && 'img_right' != $this->arr_buttons['bsweetalert_ok']['display_position']) {
  1803.     $confirmButtonFAPos 'text_right';
  1804. }
  1805. if (isset($this->arr_buttons['bsweetalert_cancel']) && isset($this->arr_buttons['bsweetalert_cancel']['display_position']) && 'img_right' != $this->arr_buttons['bsweetalert_cancel']['display_position']) {
  1806.     $cancelButtonFAPos 'text_right';
  1807. }
  1808. ?>
  1809. <script type="text/javascript">
  1810.   var scSweetAlertConfirmButton = "<?php echo $confirmButtonClass ?>";
  1811.   var scSweetAlertCancelButton = "<?php echo $cancelButtonClass ?>";
  1812.   var scSweetAlertConfirmButtonText = "<?php echo $confirmButtonText ?>";
  1813.   var scSweetAlertCancelButtonText = "<?php echo $cancelButtonText ?>";
  1814.   var scSweetAlertConfirmButtonFA = "<?php echo $confirmButtonFA ?>";
  1815.   var scSweetAlertCancelButtonFA = "<?php echo $cancelButtonFA ?>";
  1816.   var scSweetAlertConfirmButtonFAPos = "<?php echo $confirmButtonFAPos ?>";
  1817.   var scSweetAlertCancelButtonFAPos = "<?php echo $cancelButtonFAPos ?>";
  1818. </script>
  1819. <script type="text/javascript">
  1820. $(function() {
  1821. <?php
  1822. if (count($this->nm_mens_alert) || count($this->Ini->nm_mens_alert)) {
  1823.    if (isset($this->Ini->nm_mens_alert) && !empty($this->Ini->nm_mens_alert))
  1824.    {
  1825.        if (isset($this->nm_mens_alert) && !empty($this->nm_mens_alert))
  1826.        {
  1827.            $this->nm_mens_alert   array_merge($this->Ini->nm_mens_alert$this->nm_mens_alert);
  1828.            $this->nm_params_alert array_merge($this->Ini->nm_params_alert$this->nm_params_alert);
  1829.        }
  1830.        else
  1831.        {
  1832.            $this->nm_mens_alert   $this->Ini->nm_mens_alert;
  1833.            $this->nm_params_alert $this->Ini->nm_params_alert;
  1834.        }
  1835.    }
  1836.    if (isset($this->nm_mens_alert) && !empty($this->nm_mens_alert))
  1837.    {
  1838.        foreach ($this->nm_mens_alert as $i_alert => $mensagem)
  1839.        {
  1840.            $alertParams = array();
  1841.            if (isset($this->nm_params_alert[$i_alert]))
  1842.            {
  1843.                foreach ($this->nm_params_alert[$i_alert] as $paramName => $paramValue)
  1844.                {
  1845.                    if (in_array($paramName, array('title''timer''confirmButtonText''confirmButtonFA''confirmButtonFAPos''cancelButtonText''cancelButtonFA''cancelButtonFAPos''footer''width''padding')))
  1846.                    {
  1847.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1848.                    }
  1849.                    elseif (in_array($paramName, array('showConfirmButton''showCancelButton''toast')) && in_array($paramValue, array(truefalse)))
  1850.                    {
  1851.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1852.                    }
  1853.                    elseif ('position' == $paramName && in_array($paramValue, array('top''top-start''top-end''center''center-start''center-end''bottom''bottom-start''bottom-end')))
  1854.                    {
  1855.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1856.                    }
  1857.                    elseif ('type' == $paramName && in_array($paramValue, array('warning''error''success''info''question')))
  1858.                    {
  1859.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1860.                    }
  1861.                    elseif ('background' == $paramName)
  1862.                    {
  1863.                        $image_param $paramValue;
  1864.                        preg_match_all('/url\(([\s])?(["|\'])?(.*?)(["|\'])?([\s])?\)/i'$paramValue$matchesPREG_PATTERN_ORDER);
  1865.                        if (isset($matches[3])) {
  1866.                            foreach ($matches[3] as $match) {
  1867.                                if ('http:' != substr($match05) && 'https:' != substr($match06) && '/' != substr($match01)) {
  1868.                                    $image_param str_replace($match"{$this->Ini->path_img_global}/{$match}"$image_param);
  1869.                                }
  1870.                            }
  1871.                        }
  1872.                        $paramValue $image_param;
  1873.                        $alertParams[$paramName] = NM_charset_to_utf8($paramValue);
  1874.                    }
  1875.                }
  1876.            }
  1877.            $jsonParams json_encode($alertParams);
  1878.            if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  1879.            { 
  1880.                $this->Ini->Arr_result['AlertJS'][] = NM_charset_to_utf8($mensagem);
  1881.                $this->Ini->Arr_result['AlertJSParam'][] = $alertParams;
  1882.            } 
  1883.            else 
  1884.            { 
  1885. ?>
  1886.        scJs_alert('<?php echo $mensagem ?>', <?php echo $jsonParams ?>);
  1887. <?php
  1888.            } 
  1889.        }
  1890.    }
  1891. }
  1892. ?>
  1893. });
  1894. </script>
  1895. <?php
  1896. if ('' != $this->Campos_Mens_erro) {
  1897. ?>
  1898. <script type="text/javascript">
  1899. $(function() {
  1900.     _nmAjaxShowMessage({title: "<?php echo $this->Ini->Nm_lang['lang_errm_errt']; ?>", message: "<?php echo $this->Campos_Mens_erro ?>", isModal: false, timeout: "", showButton: true, buttonLabel: "", topPos: "", leftPos: "", width: "", height: "", redirUrl: "", redirTarget: "", redirParam: "", showClose: false, showBodyIcon: false, isToast: false, toastPos: "", type: "error"});
  1901. });
  1902. </script>
  1903. <?php
  1904. }
  1905. ?>
  1906. <script type="text/javascript" src="grid_new_message.js"></script>
  1907.  <SCRIPT type="text/javascript">

  1908. <?php
  1909. if (is_file($this->Ini->root $this->Ini->path_link "_lib/js/tab_erro_" $this->Ini->str_lang ".js"))
  1910. {
  1911.     $Tb_err_js file($this->Ini->root $this->Ini->path_link "_lib/js/tab_erro_" $this->Ini->str_lang ".js");
  1912.     foreach ($Tb_err_js as $Lines)
  1913.     {
  1914.         if (NM_is_utf8($Lines) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  1915.         {
  1916.             $Lines sc_convert_encoding($Lines$_SESSION['scriptcase']['charset'], "UTF-8");
  1917.         }
  1918.         echo $Lines;
  1919.     }
  1920. }
  1921.  if (NM_is_utf8($Lines) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  1922.  {
  1923.     $Msg_Inval sc_convert_encoding("Inv�lido"$_SESSION['scriptcase']['charset'], "UTF-8");
  1924.  }
  1925. ?>
  1926. var SC_crit_inv = "<?php echo $Msg_Inval ?>";
  1927. var nmdg_Form = "F1";

  1928.  $(function() {

  1929.    SC_carga_evt_jquery();
  1930.    scLoadScInput('input:text.sc-js-input');
  1931.  });
  1932.  function nm_campos_between(nm_campo, nm_cond, nm_nome_obj)
  1933.  {
  1934.   if (nm_cond.value == "bw")
  1935.   {
  1936.    nm_campo.style.display = "";
  1937.   }
  1938.   else
  1939.   {
  1940.     if (nm_campo)
  1941.     {
  1942.       nm_campo.style.display = "none";
  1943.     }
  1944.   }
  1945.   if (document.getElementById('id_hide_' + nm_nome_obj))
  1946.   {
  1947.       if (nm_cond.value == "nu" || nm_cond.value == "nn" || nm_cond.value == "ep" || nm_cond.value == "ne")
  1948.       {
  1949.           document.getElementById('id_hide_' + nm_nome_obj).style.display = 'none';
  1950.       }
  1951.       else
  1952.       {
  1953.           document.getElementById('id_hide_' + nm_nome_obj).style.display = '';
  1954.       }
  1955.   }
  1956.  }
  1957.  function nm_save_form(pos)
  1958.  {
  1959.   if (pos == 'top' && document.F1.nmgp_save_name_top.value == '')
  1960.   {
  1961.       return;
  1962.   }
  1963.   if (pos == 'bot' && document.F1.nmgp_save_name_bot.value == '')
  1964.   {
  1965.       return;
  1966.   }
  1967.   if (pos == 'fields' && document.F1.nmgp_save_name_fields.value == '')
  1968.   {
  1969.       return;
  1970.   }
  1971.   var str_out = "";
  1972.   str_out += 'SC_proprietarios_idproprietario_cond#NMF#' + search_get_sel_txt('SC_proprietarios_idproprietario_cond') + '@NMF@';
  1973.   str_out += 'SC_proprietarios_idproprietario#NMF#' + search_get_text('SC_proprietarios_idproprietario') + '@NMF@';
  1974.   str_out += 'SC_proprietarios_nome_cond#NMF#' + search_get_sel_txt('SC_proprietarios_nome_cond') + '@NMF@';
  1975.   str_out += 'SC_proprietarios_nome#NMF#' + search_get_text('SC_proprietarios_nome') + '@NMF@';
  1976.   str_out += 'id_ac_proprietarios_nome#NMF#' + search_get_text('id_ac_proprietarios_nome') + '@NMF@';
  1977.   str_out += 'SC_proprietarios_sexo_cond#NMF#' + search_get_sel_txt('SC_proprietarios_sexo_cond') + '@NMF@';
  1978.   str_out += 'SC_proprietarios_sexo#NMF#' + search_get_text('SC_proprietarios_sexo') + '@NMF@';
  1979.   str_out += 'id_ac_proprietarios_sexo#NMF#' + search_get_text('id_ac_proprietarios_sexo') + '@NMF@';
  1980.   str_out += 'SC_proprietarios_cpf_cond#NMF#' + search_get_sel_txt('SC_proprietarios_cpf_cond') + '@NMF@';
  1981.   str_out += 'SC_proprietarios_cpf#NMF#' + search_get_text('SC_proprietarios_cpf') + '@NMF@';
  1982.   str_out += 'SC_NM_operador#NMF#' + search_get_text('SC_NM_operador');
  1983.   str_out  = str_out.replace(/[+]/g, "__NM_PLUS__");
  1984.   str_out  = str_out.replace(/[&]/g, "__NM_AMP__");
  1985.   str_out  = str_out.replace(/[%]/g, "__NM_PRC__");
  1986.   var save_name = search_get_text('SC_nmgp_save_name_' + pos);
  1987.   var save_opt  = search_get_sel_txt('SC_nmgp_save_option_' + pos);
  1988.   ajax_save_filter(save_name, save_opt, str_out, pos);
  1989.  }
  1990.  function nm_submit_filter(obj_sel, pos)
  1991.  {
  1992.   index = obj_sel.selectedIndex;
  1993.   if (index == -1 || obj_sel.options[index].value == "") 
  1994.   {
  1995.       return false;
  1996.   }
  1997.   ajax_select_filter(obj_sel.options[index].value);
  1998.  }
  1999.  function nm_submit_filter_del(pos)
  2000.  {
  2001.   obj_sel = document.F1.elements['NM_filters_del_' + pos];
  2002.   index   = obj_sel.selectedIndex;
  2003.   if (index == -1 || obj_sel.options[index].value == "") 
  2004.   {
  2005.       return false;
  2006.   }
  2007.   parm = obj_sel.options[index].value;
  2008.   ajax_delete_filter(parm);
  2009.  }
  2010.  function search_get_select(obj_id)
  2011.  {
  2012.     var index = document.getElementById(obj_id).selectedIndex;
  2013.     if (index != -1) {
  2014.         return document.getElementById(obj_id).options[index].value;
  2015.     }
  2016.     else {
  2017.         return '';
  2018.     }
  2019.  }
  2020.  function search_get_selmult(obj_id)
  2021.  {
  2022.     var obj = document.getElementById(obj_id);
  2023.     var val = "_NM_array_";
  2024.     for (iSelect = 0; iSelect < obj.length; iSelect++)
  2025.     {
  2026.         if (obj[iSelect].selected)
  2027.         {
  2028.             val += "#NMARR#" + obj[iSelect].value;
  2029.         }
  2030.     }
  2031.     return val;
  2032.  }
  2033.  function search_get_Dselelect(obj_id)
  2034.  {
  2035.     var obj = document.getElementById(obj_id);
  2036.     var val = "_NM_array_";
  2037.     for (iSelect = 0; iSelect < obj.length; iSelect++)
  2038.     {
  2039.          val += "#NMARR#" + obj[iSelect].value;
  2040.     }
  2041.     return val;
  2042.  }
  2043.  function search_get_radio(obj_id)
  2044.  {
  2045.     var val  = "";
  2046.     if (document.getElementById(obj_id)) {
  2047.        var Nobj = document.getElementById(obj_id).name;
  2048.        var obj  = document.getElementsByName(Nobj);
  2049.        for (iRadio = 0; iRadio < obj.length; iRadio++) {
  2050.            if (obj[iRadio].checked) {
  2051.                val = obj[iRadio].value;
  2052.            }
  2053.        }
  2054.     }
  2055.     return val;
  2056.  }
  2057.  function search_get_checkbox(obj_id)
  2058.  {
  2059.     var val  = "_NM_array_";
  2060.     if (document.getElementById(obj_id)) {
  2061.        var Nobj = document.getElementById(obj_id).name;
  2062.        var obj  = document.getElementsByName(Nobj);
  2063.        if (!obj.length) {
  2064.            if (obj.checked) {
  2065.                val += "#NMARR#" + obj.value;
  2066.            }
  2067.        }
  2068.        else {
  2069.            for (iCheck = 0; iCheck < obj.length; iCheck++) {
  2070.                if (obj[iCheck].checked) {
  2071.                    val += "#NMARR#" + obj[iCheck].value;
  2072.                }
  2073.            }
  2074.        }
  2075.     }
  2076.     return val;
  2077.  }
  2078.  function search_get_text(obj_id)
  2079.  {
  2080.     var obj = document.getElementById(obj_id);
  2081.     return (obj) ? obj.value : '';
  2082.  }
  2083.  function search_get_title(obj_id)
  2084.  {
  2085.     var obj = document.getElementById(obj_id);
  2086.     return (obj) ? obj.title : '';
  2087.  }
  2088.  function search_get_sel_txt(obj_id)
  2089.  {
  2090.     var val = "";
  2091.     obj_part  = document.getElementById(obj_id);
  2092.     if (obj_part && obj_part.type.substr(0, 6) == 'select')
  2093.     {
  2094.         val = search_get_select(obj_id);
  2095.     }
  2096.     else
  2097.     {
  2098.         val = (obj_part) ? obj_part.value : '';
  2099.     }
  2100.     return val;
  2101.  }
  2102.  function search_get_html(obj_id)
  2103.  {
  2104.     var obj = document.getElementById(obj_id);
  2105.     return obj.innerHTML;
  2106.  }
  2107. function nm_open_popup(parms)
  2108. {
  2109.     NovaJanela = window.open (parms, '', 'resizable, scrollbars');
  2110. }
  2111.  </SCRIPT>
  2112. <script type="text/javascript">
  2113.  $(function() {
  2114.    $("#id_ac_proprietarios_nome").autocomplete({
  2115.      minLength: 1,
  2116.      source: function (request, response) {
  2117.      $.ajax({
  2118.        url: "index.php",
  2119.        dataType: "json",
  2120.        data: {
  2121.           q: request.term,
  2122.           nmgp_opcao: "ajax_autocomp",
  2123.           nmgp_parms: "NM_ajax_opcao?#?autocomp_proprietarios_nome",
  2124.           max_itens: "10",
  2125.           cod_desc: "N",
  2126.           script_case_init: <?php echo $this->Ini->sc_page ?>
  2127.         },
  2128.        success: function (data) {
  2129.          if (data == "ss_time_out") {
  2130.              nm_move();
  2131.          }
  2132.          response(data);
  2133.        }
  2134.       });
  2135.     },
  2136.      select: function (event, ui) {
  2137.        $("#SC_proprietarios_nome").val(ui.item.value);
  2138.        $(this).val(ui.item.label);
  2139.        event.preventDefault();
  2140.      },
  2141.      focus: function (event, ui) {
  2142.        $("#SC_proprietarios_nome").val(ui.item.value);
  2143.        $(this).val(ui.item.label);
  2144.        event.preventDefault();
  2145.      },
  2146.      change: function (event, ui) {
  2147.        if (null == ui.item) {
  2148.           $("#SC_proprietarios_nome").val( $(this).val() );
  2149.        }
  2150.      }
  2151.    });
  2152.    $("#id_ac_proprietarios_sexo").autocomplete({
  2153.      minLength: 1,
  2154.      source: function (request, response) {
  2155.      $.ajax({
  2156.        url: "index.php",
  2157.        dataType: "json",
  2158.        data: {
  2159.           q: request.term,
  2160.           nmgp_opcao: "ajax_autocomp",
  2161.           nmgp_parms: "NM_ajax_opcao?#?autocomp_proprietarios_sexo",
  2162.           max_itens: "10",
  2163.           cod_desc: "N",
  2164.           script_case_init: <?php echo $this->Ini->sc_page ?>
  2165.         },
  2166.        success: function (data) {
  2167.          if (data == "ss_time_out") {
  2168.              nm_move();
  2169.          }
  2170.          response(data);
  2171.        }
  2172.       });
  2173.     },
  2174.      select: function (event, ui) {
  2175.        $("#SC_proprietarios_sexo").val(ui.item.value);
  2176.        $(this).val(ui.item.label);
  2177.        event.preventDefault();
  2178.      },
  2179.      focus: function (event, ui) {
  2180.        $("#SC_proprietarios_sexo").val(ui.item.value);
  2181.        $(this).val(ui.item.label);
  2182.        event.preventDefault();
  2183.      },
  2184.      change: function (event, ui) {
  2185.        if (null == ui.item) {
  2186.           $("#SC_proprietarios_sexo").val( $(this).val() );
  2187.        }
  2188.      }
  2189.    });
  2190.  });
  2191. </script>
  2192.  <FORM name="F1" action="./" method="post" target="_self"> 
  2193.  <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  2194.  <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  2195.  <INPUT type="hidden" name="nmgp_opcao" value="busca"> 
  2196.  <div id="idJSSpecChar" style="display:none;"></div>
  2197.  <div id="id_div_process" style="display: none; position: absolute"><table class="scFilterTable"><tr><td class="scFilterLabelOdd"><?php echo $this->Ini->Nm_lang['lang_othr_prcs']; ?>...</td></tr></table></div>
  2198.  <div id="id_fatal_error" class="scFilterFieldOdd" style="display:none; position: absolute"></div>
  2199. <TABLE id="main_table" align="center" valign="top" >
  2200. <tr>
  2201. <td>
  2202. <div class="scFilterBorder">
  2203.   <div id="id_div_process_block" style="display: none; margin: 10px; whitespace: nowrap"><span class="scFormProcess"><img border="0" src="<?php echo $this->Ini->path_icones ?>/scriptcase__NM__ajax_load.gif" align="absmiddle" />&nbsp;<?php echo $this->Ini->Nm_lang['lang_othr_prcs'?>...</span></div>
  2204. <table cellspacing=0 cellpadding=0 width='100%'>
  2205. <?php
  2206.    }

  2207.    /**
  2208.     * @access  public
  2209.     * @global  string  $bprocessa  
  2210.     */
  2211.    /**
  2212.     * @access  public
  2213.     */
  2214.    function monta_cabecalho()
  2215.    {
  2216.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_info']['compact_mode'])
  2217.       {
  2218.           return;
  2219.       }
  2220.       $Str_date strtolower($_SESSION['scriptcase']['reg_conf']['date_format']);
  2221.       $Lim   strlen($Str_date);
  2222.       $Ult   "";
  2223.       $Arr_D = array();
  2224.       for ($I 0$I $Lim$I++)
  2225.       {
  2226.           $Char substr($Str_date$I1);
  2227.           if ($Char != $Ult)
  2228.           {
  2229.               $Arr_D[] = $Char;
  2230.           }
  2231.           $Ult $Char;
  2232.       }
  2233.       $Prim true;
  2234.       $Str  "";
  2235.       foreach ($Arr_D as $Cada_d)
  2236.       {
  2237.           $Str .= (!$Prim) ? $_SESSION['scriptcase']['reg_conf']['date_sep'] : "";
  2238.           $Str .= $Cada_d;
  2239.           $Prim false;
  2240.       }
  2241.       $Str str_replace("a""Y"$Str);
  2242.       $Str str_replace("y""Y"$Str);
  2243.       $nm_data_fixa date($Str); 
  2244. ?>
  2245.  <TR align="center">
  2246.   <TD class="scFilterTableTd">
  2247. <style>
  2248.     .scMenuTHeaderFont img, .scGridHeaderFont img , .scFormHeaderFont img , .scTabHeaderFont img , .scContainerHeaderFont img , .scFilterHeaderFont img { height:23px;}
  2249. </style>
  2250. <div class="scFilterHeader" style="height: 54px; padding: 17px 15px; box-sizing: border-box;margin: -1px 0px 0px 0px;width: 100%;">
  2251.     <div class="scFilterHeaderFont" style="float: left; text-transform: uppercase;"><?php echo $this->Ini->Nm_lang['lang_othr_srch_title'?> </div>
  2252.     <div class="scFilterHeaderFont" style="float: right;"><?php echo $nm_data_fixa?></div>
  2253. </div>  </TD>
  2254.  </TR>
  2255. <?php
  2256.    }

  2257.    /**
  2258.     * @access  public
  2259.     * @global  string  $nm_url_saida  $this->Ini->Nm_lang['pesq_global_nm_url_saida']
  2260.     * @global  integer  $nm_apl_dependente  $this->Ini->Nm_lang['pesq_global_nm_apl_dependente']
  2261.     * @global  string  $nmgp_parms  
  2262.     * @global  string  $bprocessa  $this->Ini->Nm_lang['pesq_global_bprocessa']
  2263.     */
  2264.    function monta_form()
  2265.    {
  2266.       global 
  2267.              $proprietarios_idproprietario_cond$proprietarios_idproprietario,
  2268.              $proprietarios_nome_cond$proprietarios_nome$proprietarios_nome_autocomp,
  2269.              $proprietarios_sexo_cond$proprietarios_sexo$proprietarios_sexo_autocomp,
  2270.              $proprietarios_cpf_cond$proprietarios_cpf,
  2271.              $nm_url_saida$nm_apl_dependente$nmgp_parms$bprocessa$nmgp_save_name$NM_operador$NM_filters$nmgp_save_option$NM_filters_del$Script_BI;
  2272.       $Script_BI "";
  2273.       $this->nmgp_botoes['clear'] = "on";
  2274.       $this->nmgp_botoes['save'] = "on";
  2275.       if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display']))
  2276.       {
  2277.           foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['btn_display'] as $NM_cada_btn => $NM_cada_opc)
  2278.           {
  2279.               $this->nmgp_botoes[$NM_cada_btn] = $NM_cada_opc;
  2280.           }
  2281.       }
  2282.       $this->aba_iframe false;
  2283.       if (isset($_SESSION['scriptcase']['sc_aba_iframe']))
  2284.       {
  2285.           foreach ($_SESSION['scriptcase']['sc_aba_iframe'] as $aba => $apls_aba)
  2286.           {
  2287.               if (in_array("grid_new"$apls_aba))
  2288.               {
  2289.                   $this->aba_iframe true;
  2290.                   break;
  2291.               }
  2292.           }
  2293.       }
  2294.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['iframe_menu'] && (!isset($_SESSION['scriptcase']['menu_mobile']) || empty($_SESSION['scriptcase']['menu_mobile'])))
  2295.       {
  2296.           $this->aba_iframe true;
  2297.       }
  2298.       $nmgp_tab_label "";
  2299.       $delimitador "##@@";
  2300.       if (empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && $bprocessa != "recarga" && $bprocessa != "save_form" && $bprocessa != "filter_save" && $bprocessa != "filter_delete")
  2301.       {
  2302.       }
  2303.       if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && $bprocessa != "recarga" && $bprocessa != "save_form" && $bprocessa != "filter_save" && $bprocessa != "filter_delete")
  2304.       { 
  2305.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  2306.           {
  2307.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = NM_conv_charset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'], $_SESSION['scriptcase']['charset'], "UTF-8");
  2308.           }
  2309.           $proprietarios_idproprietario $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_idproprietario']; 
  2310.           $proprietarios_idproprietario_cond $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_idproprietario_cond']; 
  2311.           $proprietarios_nome $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_nome']; 
  2312.           $proprietarios_nome_cond $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_nome_cond']; 
  2313.           $proprietarios_sexo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_sexo']; 
  2314.           $proprietarios_sexo_cond $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_sexo_cond']; 
  2315.           $proprietarios_cpf $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_cpf']; 
  2316.           $proprietarios_cpf_cond $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_cpf_cond']; 
  2317.           $this->NM_operador $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['NM_operador']; 
  2318.           if (strtoupper($proprietarios_idproprietario_cond) != "II" && strtoupper($proprietarios_idproprietario_cond) != "QP" && strtoupper($proprietarios_idproprietario_cond) != "NP" && strtoupper($proprietarios_idproprietario_cond) != "IN"
  2319.           { 
  2320.               nmgp_Form_Num_Val($proprietarios_idproprietario$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  2321.           } 
  2322.           if (strtoupper($proprietarios_cpf_cond) != "II" && strtoupper($proprietarios_cpf_cond) != "QP" && strtoupper($proprietarios_cpf_cond) != "NP" && strtoupper($proprietarios_cpf_cond) != "IN"
  2323.           { 
  2324.               nmgp_Form_Num_Val($proprietarios_cpf$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  2325.           } 
  2326.       } 
  2327.       if (!isset($proprietarios_idproprietario_cond) || empty($proprietarios_idproprietario_cond))
  2328.       {
  2329.          $proprietarios_idproprietario_cond "gt";
  2330.       }
  2331.       if (!isset($proprietarios_nome_cond) || empty($proprietarios_nome_cond))
  2332.       {
  2333.          $proprietarios_nome_cond "qp";
  2334.       }
  2335.       if (!isset($proprietarios_sexo_cond) || empty($proprietarios_sexo_cond))
  2336.       {
  2337.          $proprietarios_sexo_cond "qp";
  2338.       }
  2339.       if (!isset($proprietarios_cpf_cond) || empty($proprietarios_cpf_cond))
  2340.       {
  2341.          $proprietarios_cpf_cond "gt";
  2342.       }
  2343.       $display_aberto  "style=display:";
  2344.       $display_fechado "style=display:none";
  2345.       $opc_hide_input = array("nu","nn","ep","ne");
  2346.       $str_hide_proprietarios_idproprietario = (in_array($proprietarios_idproprietario_cond$opc_hide_input)) ? $display_fechado $display_aberto;
  2347.       $str_hide_proprietarios_nome = (in_array($proprietarios_nome_cond$opc_hide_input)) ? $display_fechado $display_aberto;
  2348.       $str_hide_proprietarios_sexo = (in_array($proprietarios_sexo_cond$opc_hide_input)) ? $display_fechado $display_aberto;
  2349.       $str_hide_proprietarios_cpf = (in_array($proprietarios_cpf_cond$opc_hide_input)) ? $display_fechado $display_aberto;

  2350.       if (!isset($proprietarios_idproprietario) || $proprietarios_idproprietario == "")
  2351.       {
  2352.           $proprietarios_idproprietario "";
  2353.       }
  2354.       if (isset($proprietarios_idproprietario) && !empty($proprietarios_idproprietario))
  2355.       {
  2356.          $tmp_pos strpos($proprietarios_idproprietario"##@@");
  2357.          if ($tmp_pos === false)
  2358.          { }
  2359.          else
  2360.          {
  2361.          $proprietarios_idproprietario substr($proprietarios_idproprietario0$tmp_pos);
  2362.          }
  2363.       }
  2364.       if (!isset($proprietarios_nome) || $proprietarios_nome == "")
  2365.       {
  2366.           $proprietarios_nome "";
  2367.       }
  2368.       if (isset($proprietarios_nome) && !empty($proprietarios_nome))
  2369.       {
  2370.          $tmp_pos strpos($proprietarios_nome"##@@");
  2371.          if ($tmp_pos === false)
  2372.          { }
  2373.          else
  2374.          {
  2375.          $proprietarios_nome substr($proprietarios_nome0$tmp_pos);
  2376.          }
  2377.       }
  2378.       if (!isset($proprietarios_sexo) || $proprietarios_sexo == "")
  2379.       {
  2380.           $proprietarios_sexo "";
  2381.       }
  2382.       if (isset($proprietarios_sexo) && !empty($proprietarios_sexo))
  2383.       {
  2384.          $tmp_pos strpos($proprietarios_sexo"##@@");
  2385.          if ($tmp_pos === false)
  2386.          { }
  2387.          else
  2388.          {
  2389.          $proprietarios_sexo substr($proprietarios_sexo0$tmp_pos);
  2390.          }
  2391.       }
  2392.       if (!isset($proprietarios_cpf) || $proprietarios_cpf == "")
  2393.       {
  2394.           $proprietarios_cpf "";
  2395.       }
  2396.       if (isset($proprietarios_cpf) && !empty($proprietarios_cpf))
  2397.       {
  2398.          $tmp_pos strpos($proprietarios_cpf"##@@");
  2399.          if ($tmp_pos === false)
  2400.          { }
  2401.          else
  2402.          {
  2403.          $proprietarios_cpf substr($proprietarios_cpf0$tmp_pos);
  2404.          }
  2405.       }
  2406. ?>
  2407.  <TR align="center">
  2408.   <TD class="scFilterTableTd">
  2409.    <TABLE style="padding: 0px; spacing: 0px; border-width: 0px;" width="100%" height="100%">
  2410.    <TR valign="top" >
  2411.   <TD width="100%" height="">
  2412.    <TABLE class="scFilterTable" id="hidden_bloco_0" valign="top" width="100%" style="height: 100%;">
  2413.    <tr>





  2414.       <TD class="scFilterLabelOdd"><?php echo (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario"?></TD>
  2415.      <TD class="scFilterFieldOdd"> 
  2416.       <SELECT class="scFilterObjectOdd" id="SC_proprietarios_idproprietario_cond" name="proprietarios_idproprietario_cond" onChange="nm_campos_between(document.getElementById('id_vis_proprietarios_idproprietario'), this, 'proprietarios_idproprietario')">
  2417.        <OPTION value="gt" <?php if ("gt" == $proprietarios_idproprietario_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_grtr'?></OPTION>
  2418.        <OPTION value="lt" <?php if ("lt" == $proprietarios_idproprietario_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_less'?></OPTION>
  2419.        <OPTION value="eq" <?php if ("eq" == $proprietarios_idproprietario_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_exac'?></OPTION>
  2420.       </SELECT>
  2421.        </TD>
  2422.      <TD  class="scFilterFieldOdd">
  2423.       <TABLE  border="0" cellpadding="0" cellspacing="0">
  2424.        <TR id="id_hide_proprietarios_idproprietario" <?php echo $str_hide_proprietarios_idproprietario?> valign="top">
  2425.         <TD class="scFilterFieldFontOdd">
  2426.            <?php
  2427.  $SC_Label = (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario";
  2428.  $nmgp_tab_label .= "proprietarios_idproprietario?#?" $SC_Label "?@?";
  2429.  $date_sep_bw " " $this->Ini->Nm_lang['lang_srch_between_values'] . " ";
  2430.  if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($date_sep_bw))
  2431.  {
  2432.      $date_sep_bw sc_convert_encoding($date_sep_bw$_SESSION['scriptcase']['charset'], "UTF-8");
  2433.  }
  2434. ?>
  2435. <INPUT  type="text" id="SC_proprietarios_idproprietario" name="proprietarios_idproprietario" value="<?php echo NM_encode_input($proprietarios_idproprietario?>" size=11 alt="{datatype: 'integer', maxLength: 11, thousandsSep: '<?php echo $_SESSION['scriptcase']['reg_conf']['grup_num'?>', allowNegative: false, onlyNegative: false, enterTab: false}" class="sc-js-input scFilterObjectOdd">

  2436.         </TD>
  2437.        </TR>
  2438.       </TABLE>
  2439.      </TD>

  2440.    </tr><tr>





  2441.       <TD class="scFilterLabelEven"><?php echo (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome"?></TD>
  2442.      <TD class="scFilterFieldEven"> 
  2443.       <SELECT class="scFilterObjectEven" id="SC_proprietarios_nome_cond" name="proprietarios_nome_cond" onChange="nm_campos_between(document.getElementById('id_vis_proprietarios_nome'), this, 'proprietarios_nome')">
  2444.        <OPTION value="qp" <?php if ("qp" == $proprietarios_nome_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_like'?></OPTION>
  2445.        <OPTION value="np" <?php if ("np" == $proprietarios_nome_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_not_like'?></OPTION>
  2446.        <OPTION value="eq" <?php if ("eq" == $proprietarios_nome_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_exac'?></OPTION>
  2447.        <OPTION value="ep" <?php if ("ep" == $proprietarios_nome_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_empty'?></OPTION>
  2448.       </SELECT>
  2449.        </TD>
  2450.      <TD  class="scFilterFieldEven">
  2451.       <TABLE  border="0" cellpadding="0" cellspacing="0">
  2452.        <TR id="id_hide_proprietarios_nome" <?php echo $str_hide_proprietarios_nome?> valign="top">
  2453.         <TD class="scFilterFieldFontEven">
  2454.            <?php
  2455.  $SC_Label = (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome";
  2456.  $nmgp_tab_label .= "proprietarios_nome?#?" $SC_Label "?@?";
  2457.  $date_sep_bw " " $this->Ini->Nm_lang['lang_srch_between_values'] . " ";
  2458.  if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($date_sep_bw))
  2459.  {
  2460.      $date_sep_bw sc_convert_encoding($date_sep_bw$_SESSION['scriptcase']['charset'], "UTF-8");
  2461.  }
  2462. ?>
  2463. <?php
  2464.       if ($proprietarios_nome != "")
  2465.       {
  2466.       $proprietarios_nome_look substr($this->Db->qstr($proprietarios_nome), 1, -1); 
  2467.       $nmgp_def_dados = array(); 
  2468.       $nm_comando "select distinct Proprietarios.Nome from " $this->Ini->nm_tabela " where Proprietarios.Nome = '$proprietarios_nome_look' order by Proprietarios.Nome"
  2469.       unset($cmp1,$cmp2);
  2470.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  2471.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  2472.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  2473.       { 
  2474.          while (!$rs->EOF
  2475.          { 
  2476.             $cmp1 trim($rs->fields[0]);
  2477.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  2478.             $rs->MoveNext() ; 
  2479.          } 
  2480.          $rs->Close() ; 
  2481.       } 
  2482.       else  
  2483.       {  
  2484.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  2485.          exit; 
  2486.       } 
  2487.       }
  2488.       if (isset($nmgp_def_dados[0][$proprietarios_nome]))
  2489.       {
  2490.           $sAutocompValue $nmgp_def_dados[0][$proprietarios_nome];
  2491.       }
  2492.       else
  2493.       {
  2494.           $sAutocompValue $proprietarios_nome;
  2495.       }
  2496. ?>
  2497. <INPUT  type="text" id="SC_proprietarios_nome" name="proprietarios_nome" value="<?php echo NM_encode_input($proprietarios_nome?>"  size=45 alt="{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}" style="display: none">
  2498. <input class="sc-js-input scFilterObjectEven" type="text" id="id_ac_proprietarios_nome" name="proprietarios_nome_autocomp" size="45"  value="<?php echo NM_encode_input($sAutocompValue); ?>" alt="{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}">


  2499.         </TD>
  2500.        </TR>
  2501.       </TABLE>
  2502.      </TD>

  2503.    </tr><tr>





  2504.       <TD class="scFilterLabelOdd"><?php echo (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo"?></TD>
  2505.      <TD class="scFilterFieldOdd"> 
  2506.       <SELECT class="scFilterObjectOdd" id="SC_proprietarios_sexo_cond" name="proprietarios_sexo_cond" onChange="nm_campos_between(document.getElementById('id_vis_proprietarios_sexo'), this, 'proprietarios_sexo')">
  2507.        <OPTION value="qp" <?php if ("qp" == $proprietarios_sexo_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_like'?></OPTION>
  2508.        <OPTION value="np" <?php if ("np" == $proprietarios_sexo_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_not_like'?></OPTION>
  2509.        <OPTION value="eq" <?php if ("eq" == $proprietarios_sexo_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_exac'?></OPTION>
  2510.        <OPTION value="ep" <?php if ("ep" == $proprietarios_sexo_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_empty'?></OPTION>
  2511.       </SELECT>
  2512.        </TD>
  2513.      <TD  class="scFilterFieldOdd">
  2514.       <TABLE  border="0" cellpadding="0" cellspacing="0">
  2515.        <TR id="id_hide_proprietarios_sexo" <?php echo $str_hide_proprietarios_sexo?> valign="top">
  2516.         <TD class="scFilterFieldFontOdd">
  2517.            <?php
  2518.  $SC_Label = (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo";
  2519.  $nmgp_tab_label .= "proprietarios_sexo?#?" $SC_Label "?@?";
  2520.  $date_sep_bw " " $this->Ini->Nm_lang['lang_srch_between_values'] . " ";
  2521.  if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($date_sep_bw))
  2522.  {
  2523.      $date_sep_bw sc_convert_encoding($date_sep_bw$_SESSION['scriptcase']['charset'], "UTF-8");
  2524.  }
  2525. ?>
  2526. <?php
  2527.       if ($proprietarios_sexo != "")
  2528.       {
  2529.       $proprietarios_sexo_look substr($this->Db->qstr($proprietarios_sexo), 1, -1); 
  2530.       $nmgp_def_dados = array(); 
  2531.       $nm_comando "select distinct Proprietarios.Sexo from " $this->Ini->nm_tabela " where Proprietarios.Sexo = '$proprietarios_sexo_look' order by Proprietarios.Sexo"
  2532.       unset($cmp1,$cmp2);
  2533.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  2534.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  2535.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  2536.       { 
  2537.          while (!$rs->EOF
  2538.          { 
  2539.             $cmp1 trim($rs->fields[0]);
  2540.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  2541.             $rs->MoveNext() ; 
  2542.          } 
  2543.          $rs->Close() ; 
  2544.       } 
  2545.       else  
  2546.       {  
  2547.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  2548.          exit; 
  2549.       } 
  2550.       }
  2551.       if (isset($nmgp_def_dados[0][$proprietarios_sexo]))
  2552.       {
  2553.           $sAutocompValue $nmgp_def_dados[0][$proprietarios_sexo];
  2554.       }
  2555.       else
  2556.       {
  2557.           $sAutocompValue $proprietarios_sexo;
  2558.       }
  2559. ?>
  2560. <INPUT  type="text" id="SC_proprietarios_sexo" name="proprietarios_sexo" value="<?php echo NM_encode_input($proprietarios_sexo?>"  size=45 alt="{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}" style="display: none">
  2561. <input class="sc-js-input scFilterObjectOdd" type="text" id="id_ac_proprietarios_sexo" name="proprietarios_sexo_autocomp" size="45"  value="<?php echo NM_encode_input($sAutocompValue); ?>" alt="{datatype: 'text', maxLength: 45, allowedChars: '', lettersCase: '', autoTab: false, enterTab: false}">


  2562.         </TD>
  2563.        </TR>
  2564.       </TABLE>
  2565.      </TD>

  2566.    </tr><tr>





  2567.       <TD class="scFilterLabelEven"><?php echo (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf"?></TD>
  2568.      <TD class="scFilterFieldEven"> 
  2569.       <SELECT class="scFilterObjectEven" id="SC_proprietarios_cpf_cond" name="proprietarios_cpf_cond" onChange="nm_campos_between(document.getElementById('id_vis_proprietarios_cpf'), this, 'proprietarios_cpf')">
  2570.        <OPTION value="gt" <?php if ("gt" == $proprietarios_cpf_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_grtr'?></OPTION>
  2571.        <OPTION value="lt" <?php if ("lt" == $proprietarios_cpf_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_less'?></OPTION>
  2572.        <OPTION value="eq" <?php if ("eq" == $proprietarios_cpf_cond) { echo "selected"; } ?>><?php echo $this->Ini->Nm_lang['lang_srch_exac'?></OPTION>
  2573.       </SELECT>
  2574.        </TD>
  2575.      <TD  class="scFilterFieldEven">
  2576.       <TABLE  border="0" cellpadding="0" cellspacing="0">
  2577.        <TR id="id_hide_proprietarios_cpf" <?php echo $str_hide_proprietarios_cpf?> valign="top">
  2578.         <TD class="scFilterFieldFontEven">
  2579.            <?php
  2580.  $SC_Label = (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf";
  2581.  $nmgp_tab_label .= "proprietarios_cpf?#?" $SC_Label "?@?";
  2582.  $date_sep_bw " " $this->Ini->Nm_lang['lang_srch_between_values'] . " ";
  2583.  if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($date_sep_bw))
  2584.  {
  2585.      $date_sep_bw sc_convert_encoding($date_sep_bw$_SESSION['scriptcase']['charset'], "UTF-8");
  2586.  }
  2587. ?>
  2588. <INPUT  type="text" id="SC_proprietarios_cpf" name="proprietarios_cpf" value="<?php echo NM_encode_input($proprietarios_cpf?>" size=11 alt="{datatype: 'integer', maxLength: 11, thousandsSep: '<?php echo $_SESSION['scriptcase']['reg_conf']['grup_num'?>', allowNegative: false, onlyNegative: false, enterTab: false}" class="sc-js-input scFilterObjectEven">

  2589.         </TD>
  2590.        </TR>
  2591.       </TABLE>
  2592.      </TD>

  2593.    </tr>
  2594.    </TABLE>
  2595.   </TD>
  2596.  </TR>
  2597.  </TABLE>
  2598.  </TD>
  2599.  </TR>
  2600.  <TR>
  2601.   <TD class="scFilterTableTd" align="center">
  2602. <INPUT type="hidden" id="SC_NM_operador" name="NM_operador" value="and">  </TD>
  2603.  </TR>
  2604.    <INPUT type="hidden" name="nmgp_tab_label" value="<?php echo NM_encode_input($nmgp_tab_label); ?>"> 
  2605.    <INPUT type="hidden" name="bprocessa" value="pesq"> 
  2606. <?php
  2607.     $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'] = $nmgp_tab_label;
  2608. ?>
  2609.  <?php
  2610.      if ($_SESSION['scriptcase']['proc_mobile'])
  2611.      {
  2612.      ?>
  2613.  <TR align="center">
  2614.   <TD class="scFilterTableTd">
  2615.    <table width="100%" class="scFilterToolbar"><tr>
  2616.     <td class="scFilterToolbarPadding" align="left" width="33%" nowrap>
  2617.     </td>
  2618.     <td class="scFilterToolbarPadding" align="center" width="33%" nowrap>
  2619.    <?php echo nmButtonOutput($this->arr_buttons"bpesquisa""document.F1.bprocessa.value='pesq'; setTimeout(function() {nm_submit_form()}, 200);""document.F1.bprocessa.value='pesq'; setTimeout(function() {nm_submit_form()}, 200);""sc_b_pesq_bot""""" $this->Ini->Nm_lang['lang_btns_srch_lone'] . """""absmiddle""""0px"$this->Ini->path_botoes"""" $this->Ini->Nm_lang['lang_btns_srch_lone_hint'] . """""""""only_text""text_right""""""""""""""");
  2620. ?>
  2621. <?php
  2622.    if ($this->nmgp_botoes['clear'] == "on")
  2623.    {
  2624. ?>
  2625.           <?php echo nmButtonOutput($this->arr_buttons"blimpar""limpa_form();""limpa_form();""limpa_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2626. ?>
  2627. <?php
  2628.    }
  2629. ?>
  2630. <?php
  2631.    if (!isset($this->nmgp_botoes['save']) || $this->nmgp_botoes['save'] == "on")
  2632.    {
  2633.        $this->NM_fil_ant $this->gera_array_filtros();
  2634. ?>
  2635.      <span id="idAjaxSelect_NM_filters_bot">
  2636.        <SELECT class="scFilterToolbar_obj" id="sel_recup_filters_bot" name="NM_filters_bot" onChange="nm_submit_filter(this, 'bot');" size="1">
  2637.            <option value=""></option>
  2638. <?php
  2639.           $Nome_filter "";
  2640.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  2641.           {
  2642.               $Select "";
  2643.               if ($Cada_filter == $this->NM_curr_fil)
  2644.               {
  2645.                   $Select "selected";
  2646.               }
  2647.               if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  2648.               {
  2649.                   $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  2650.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  2651.               }
  2652.               elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  2653.               {
  2654.                   $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  2655.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  2656.               }
  2657.               if ($Tipo_filter[1] != $Nome_filter)
  2658.               {
  2659.                   $Nome_filter $Tipo_filter[1];
  2660.                   echo "           <option value=\"\">" NM_encode_input($Nome_filter) . "</option>\r\n";
  2661.               }
  2662. ?>
  2663.            <option value="<?php echo NM_encode_input($Tipo_filter[0]) . "\" " $Select ">.." $Cada_filter ?></option>
  2664. <?php
  2665.           }
  2666. ?>
  2667.        </SELECT>
  2668.      </span>
  2669. <?php
  2670.    }
  2671. ?>
  2672. <?php
  2673.    if ($this->nmgp_botoes['save'] == "on")
  2674.    {
  2675. ?>
  2676.           <?php echo nmButtonOutput($this->arr_buttons"bedit_filter""document.getElementById('Salvar_filters_bot').style.display = ''; document.F1.nmgp_save_name_bot.focus();""document.getElementById('Salvar_filters_bot').style.display = ''; document.F1.nmgp_save_name_bot.focus();""Ativa_save_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2677. ?>
  2678. <?php
  2679.    }
  2680. ?>
  2681. <?php
  2682.    if (is_file("grid_new_help.txt"))
  2683.    {
  2684.       $Arq_WebHelp file("grid_new_help.txt"); 
  2685.       if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
  2686.       {
  2687.           $Arq_WebHelp[0] = str_replace("\r\n" ""trim($Arq_WebHelp[0]));
  2688.           $Tmp explode(";"$Arq_WebHelp[0]); 
  2689.           foreach ($Tmp as $Cada_help)
  2690.           {
  2691.               $Tmp1 explode(":"$Cada_help); 
  2692.               if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "fil" && is_file($this->Ini->root $this->Ini->path_help $Tmp1[1]))
  2693.               {
  2694. ?>
  2695.           <?php echo nmButtonOutput($this->arr_buttons"bhelp""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""sc_b_help_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2696. ?>
  2697. <?php
  2698.               }
  2699.           }
  2700.       }
  2701.    }
  2702. ?>
  2703. <?php
  2704.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start'] == 'filter' && $nm_apl_dependente != 1)
  2705.    {
  2706. ?>
  2707.        <?php echo nmButtonOutput($this->arr_buttons"bsair""document.form_cancel.submit();""document.form_cancel.submit();""sc_b_cancel_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2708. ?>
  2709. <?php
  2710.    }
  2711.    else
  2712.    {
  2713. ?>
  2714.        <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.form_cancel.submit();""document.form_cancel.submit();""sc_b_cancel_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2715. ?>
  2716. <?php
  2717.    }
  2718. ?>
  2719.     </td>
  2720.     <td class="scFilterToolbarPadding" align="right" width="33%" nowrap>
  2721.     </td>
  2722.    </tr></table>
  2723. <?php
  2724.    if ($this->nmgp_botoes['save'] == "on")
  2725.    {
  2726. ?>
  2727.     </TD></TR><TR><TD>
  2728.     <DIV id="Salvar_filters_bot" style="display:none;z-index:9999;">
  2729.      <TABLE align="center" class="scFilterTable">
  2730.       <TR>
  2731.        <TD class="scFilterBlock">
  2732.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2733.          <tr>
  2734.           <td style="padding: 0px" valign="top" class="scFilterBlockFont"><?php echo $this->Ini->Nm_lang['lang_othr_srch_head'?></td>
  2735.           <td style="padding: 0px" align="right" valign="top">
  2736.            <?php echo nmButtonOutput($this->arr_buttons"bcancelar_appdiv""document.getElementById('Salvar_filters_bot').style.display = 'none';""document.getElementById('Salvar_filters_bot').style.display = 'none';""Cancel_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2737. ?>
  2738.           </td>
  2739.          </tr>
  2740.         </table>
  2741.        </TD>
  2742.       </TR>
  2743.       <TR>
  2744.        <TD class="scFilterFieldOdd">
  2745.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2746.          <tr>
  2747.           <td style="padding: 0px" valign="top">
  2748.            <input class="scFilterObjectOdd" type="text" id="SC_nmgp_save_name_bot" name="nmgp_save_name_bot" value="">
  2749.           </td>
  2750.           <td style="padding: 0px" align="right" valign="top">
  2751.            <?php echo nmButtonOutput($this->arr_buttons"bsalvar_appdiv""nm_save_form('bot');""nm_save_form('bot');""Save_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2752. ?>
  2753.           </td>
  2754.          </tr>
  2755.         </table>
  2756.        </TD>
  2757.       </TR>
  2758.       <TR>
  2759.        <TD class="scFilterFieldEven">
  2760.        <DIV id="Apaga_filters_bot" style="display:''">
  2761.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2762.          <tr>
  2763.           <td style="padding: 0px" valign="top">
  2764.           <div id="idAjaxSelect_NM_filters_del_bot">
  2765.            <SELECT class="scFilterObjectOdd" id="sel_filters_del_bot" name="NM_filters_del_bot" size="1">
  2766.             <option value=""></option>
  2767. <?php
  2768.           $Nome_filter "";
  2769.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  2770.           {
  2771.               $Select "";
  2772.               if ($Cada_filter == $this->NM_curr_fil)
  2773.               {
  2774.                   $Select "selected";
  2775.               }
  2776.               if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  2777.               {
  2778.                   $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  2779.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  2780.               }
  2781.               elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  2782.               {
  2783.                   $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  2784.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  2785.               }
  2786.               if ($Tipo_filter[1] != $Nome_filter)
  2787.               {
  2788.                   $Nome_filter $Tipo_filter[1];
  2789.                   echo "            <option value=\"\">" NM_encode_input($Nome_filter) . "</option>\r\n";
  2790.               }
  2791. ?>
  2792.             <option value="<?php echo NM_encode_input($Tipo_filter[0]) . "\" " $Select ">.." $Cada_filter ?></option>
  2793. <?php
  2794.           }
  2795. ?>
  2796.            </SELECT>
  2797.           </div>
  2798.           </td>
  2799.           <td style="padding: 0px" align="right" valign="top">
  2800.            <?php echo nmButtonOutput($this->arr_buttons"bexcluir_appdiv""nm_submit_filter_del('bot');""nm_submit_filter_del('bot');""Exc_filtro_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2801. ?>
  2802.           </td>
  2803.          </tr>
  2804.         </table>
  2805.        </DIV>
  2806.        </TD>
  2807.       </TR>
  2808.      </TABLE>
  2809.     </DIV> 
  2810. <?php
  2811.    }
  2812. ?>
  2813.   </TD>
  2814.  </TR>
  2815.      <?php
  2816.      }
  2817.      else
  2818.      {
  2819.      ?>
  2820.  <TR align="center">
  2821.   <TD class="scFilterTableTd">
  2822.    <table width="100%" class="scFilterToolbar"><tr>
  2823.     <td class="scFilterToolbarPadding" align="left" width="33%" nowrap>
  2824.     </td>
  2825.     <td class="scFilterToolbarPadding" align="center" width="33%" nowrap>
  2826.    <?php echo nmButtonOutput($this->arr_buttons"bpesquisa""document.F1.bprocessa.value='pesq'; setTimeout(function() {nm_submit_form()}, 200);""document.F1.bprocessa.value='pesq'; setTimeout(function() {nm_submit_form()}, 200);""sc_b_pesq_bot""""" $this->Ini->Nm_lang['lang_btns_srch_lone'] . """""absmiddle""""0px"$this->Ini->path_botoes"""" $this->Ini->Nm_lang['lang_btns_srch_lone_hint'] . """""""""only_text""text_right""""""""""""""");
  2827. ?>
  2828. <?php
  2829.    if ($this->nmgp_botoes['clear'] == "on")
  2830.    {
  2831. ?>
  2832.           <?php echo nmButtonOutput($this->arr_buttons"blimpar""limpa_form();""limpa_form();""limpa_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2833. ?>
  2834. <?php
  2835.    }
  2836. ?>
  2837. <?php
  2838.    if (!isset($this->nmgp_botoes['save']) || $this->nmgp_botoes['save'] == "on")
  2839.    {
  2840.        $this->NM_fil_ant $this->gera_array_filtros();
  2841. ?>
  2842.      <span id="idAjaxSelect_NM_filters_bot">
  2843.        <SELECT class="scFilterToolbar_obj" id="sel_recup_filters_bot" name="NM_filters_bot" onChange="nm_submit_filter(this, 'bot');" size="1">
  2844.            <option value=""></option>
  2845. <?php
  2846.           $Nome_filter "";
  2847.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  2848.           {
  2849.               $Select "";
  2850.               if ($Cada_filter == $this->NM_curr_fil)
  2851.               {
  2852.                   $Select "selected";
  2853.               }
  2854.               if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  2855.               {
  2856.                   $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  2857.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  2858.               }
  2859.               elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  2860.               {
  2861.                   $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  2862.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  2863.               }
  2864.               if ($Tipo_filter[1] != $Nome_filter)
  2865.               {
  2866.                   $Nome_filter $Tipo_filter[1];
  2867.                   echo "           <option value=\"\">" NM_encode_input($Nome_filter) . "</option>\r\n";
  2868.               }
  2869. ?>
  2870.            <option value="<?php echo NM_encode_input($Tipo_filter[0]) . "\" " $Select ">.." $Cada_filter ?></option>
  2871. <?php
  2872.           }
  2873. ?>
  2874.        </SELECT>
  2875.      </span>
  2876. <?php
  2877.    }
  2878. ?>
  2879. <?php
  2880.    if ($this->nmgp_botoes['save'] == "on")
  2881.    {
  2882. ?>
  2883.           <?php echo nmButtonOutput($this->arr_buttons"bedit_filter""document.getElementById('Salvar_filters_bot').style.display = ''; document.F1.nmgp_save_name_bot.focus();""document.getElementById('Salvar_filters_bot').style.display = ''; document.F1.nmgp_save_name_bot.focus();""Ativa_save_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2884. ?>
  2885. <?php
  2886.    }
  2887. ?>
  2888. <?php
  2889.    if (is_file("grid_new_help.txt"))
  2890.    {
  2891.       $Arq_WebHelp file("grid_new_help.txt"); 
  2892.       if (isset($Arq_WebHelp[0]) && !empty($Arq_WebHelp[0]))
  2893.       {
  2894.           $Arq_WebHelp[0] = str_replace("\r\n" ""trim($Arq_WebHelp[0]));
  2895.           $Tmp explode(";"$Arq_WebHelp[0]); 
  2896.           foreach ($Tmp as $Cada_help)
  2897.           {
  2898.               $Tmp1 explode(":"$Cada_help); 
  2899.               if (!empty($Tmp1[0]) && isset($Tmp1[1]) && !empty($Tmp1[1]) && $Tmp1[0] == "fil" && is_file($this->Ini->root $this->Ini->path_help $Tmp1[1]))
  2900.               {
  2901. ?>
  2902.           <?php echo nmButtonOutput($this->arr_buttons"bhelp""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""nm_open_popup('" $this->Ini->path_help $Tmp1[1] . "');""sc_b_help_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2903. ?>
  2904. <?php
  2905.               }
  2906.           }
  2907.       }
  2908.    }
  2909. ?>
  2910. <?php
  2911.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start'] == 'filter' && $nm_apl_dependente != 1)
  2912.    {
  2913. ?>
  2914.        <?php echo nmButtonOutput($this->arr_buttons"bsair""document.form_cancel.submit();""document.form_cancel.submit();""sc_b_cancel_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2915. ?>
  2916. <?php
  2917.    }
  2918.    else
  2919.    {
  2920. ?>
  2921.        <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.form_cancel.submit();""document.form_cancel.submit();""sc_b_cancel_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2922. ?>
  2923. <?php
  2924.    }
  2925. ?>
  2926.     </td>
  2927.     <td class="scFilterToolbarPadding" align="right" width="33%" nowrap>
  2928.     </td>
  2929.    </tr></table>
  2930. <?php
  2931.    if ($this->nmgp_botoes['save'] == "on")
  2932.    {
  2933. ?>
  2934.     </TD></TR><TR><TD>
  2935.     <DIV id="Salvar_filters_bot" style="display:none;z-index:9999;">
  2936.      <TABLE align="center" class="scFilterTable">
  2937.       <TR>
  2938.        <TD class="scFilterBlock">
  2939.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2940.          <tr>
  2941.           <td style="padding: 0px" valign="top" class="scFilterBlockFont"><?php echo $this->Ini->Nm_lang['lang_othr_srch_head'?></td>
  2942.           <td style="padding: 0px" align="right" valign="top">
  2943.            <?php echo nmButtonOutput($this->arr_buttons"bcancelar_appdiv""document.getElementById('Salvar_filters_bot').style.display = 'none';""document.getElementById('Salvar_filters_bot').style.display = 'none';""Cancel_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2944. ?>
  2945.           </td>
  2946.          </tr>
  2947.         </table>
  2948.        </TD>
  2949.       </TR>
  2950.       <TR>
  2951.        <TD class="scFilterFieldOdd">
  2952.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2953.          <tr>
  2954.           <td style="padding: 0px" valign="top">
  2955.            <input class="scFilterObjectOdd" type="text" id="SC_nmgp_save_name_bot" name="nmgp_save_name_bot" value="">
  2956.           </td>
  2957.           <td style="padding: 0px" align="right" valign="top">
  2958.            <?php echo nmButtonOutput($this->arr_buttons"bsalvar_appdiv""nm_save_form('bot');""nm_save_form('bot');""Save_frm_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2959. ?>
  2960.           </td>
  2961.          </tr>
  2962.         </table>
  2963.        </TD>
  2964.       </TR>
  2965.       <TR>
  2966.        <TD class="scFilterFieldEven">
  2967.        <DIV id="Apaga_filters_bot" style="display:''">
  2968.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  2969.          <tr>
  2970.           <td style="padding: 0px" valign="top">
  2971.           <div id="idAjaxSelect_NM_filters_del_bot">
  2972.            <SELECT class="scFilterObjectOdd" id="sel_filters_del_bot" name="NM_filters_del_bot" size="1">
  2973.             <option value=""></option>
  2974. <?php
  2975.           $Nome_filter "";
  2976.           foreach ($this->NM_fil_ant as $Cada_filter => $Tipo_filter)
  2977.           {
  2978.               $Select "";
  2979.               if ($Cada_filter == $this->NM_curr_fil)
  2980.               {
  2981.                   $Select "selected";
  2982.               }
  2983.               if (NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  2984.               {
  2985.                   $Cada_filter    sc_convert_encoding($Cada_filter$_SESSION['scriptcase']['charset'], "UTF-8");
  2986.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], $_SESSION['scriptcase']['charset'], "UTF-8");
  2987.               }
  2988.               elseif (!NM_is_utf8($Cada_filter) && $_SESSION['scriptcase']['charset'] == "UTF-8")
  2989.               {
  2990.                   $Cada_filter    sc_convert_encoding($Cada_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  2991.                   $Tipo_filter[0] = sc_convert_encoding($Tipo_filter[0], "UTF-8"$_SESSION['scriptcase']['charset']);
  2992.               }
  2993.               if ($Tipo_filter[1] != $Nome_filter)
  2994.               {
  2995.                   $Nome_filter $Tipo_filter[1];
  2996.                   echo "            <option value=\"\">" NM_encode_input($Nome_filter) . "</option>\r\n";
  2997.               }
  2998. ?>
  2999.             <option value="<?php echo NM_encode_input($Tipo_filter[0]) . "\" " $Select ">.." $Cada_filter ?></option>
  3000. <?php
  3001.           }
  3002. ?>
  3003.            </SELECT>
  3004.           </div>
  3005.           </td>
  3006.           <td style="padding: 0px" align="right" valign="top">
  3007.            <?php echo nmButtonOutput($this->arr_buttons"bexcluir_appdiv""nm_submit_filter_del('bot');""nm_submit_filter_del('bot');""Exc_filtro_bot""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3008. ?>
  3009.           </td>
  3010.          </tr>
  3011.         </table>
  3012.        </DIV>
  3013.        </TD>
  3014.       </TR>
  3015.      </TABLE>
  3016.     </DIV> 
  3017. <?php
  3018.    }
  3019. ?>
  3020.   </TD>
  3021.  </TR>
  3022.      <?php
  3023.      }
  3024.  ?>
  3025. <?php
  3026.    }

  3027.    function monta_html_fim()
  3028.    {
  3029.        global $bprocessa$nm_url_saida$Script_BI;
  3030. ?>

  3031. </TABLE>
  3032.    <INPUT type="hidden" name="form_condicao" value="3">
  3033. </FORM> 
  3034. <?php
  3035.    if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start'] == 'filter')
  3036.    {
  3037. ?>
  3038.    <FORM style="display:none;" name="form_cancel"  method="POST" action="<?php echo $nm_url_saida?>" target="_self"> 
  3039. <?php
  3040.    }
  3041.    else
  3042.    {
  3043. ?>
  3044.    <FORM style="display:none;" name="form_cancel"  method="POST" action="./" target="_self"> 
  3045. <?php
  3046.    }
  3047. ?>
  3048.    <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  3049.    <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  3050. <?php
  3051.    if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq'] == "grid")
  3052.    {
  3053.        $Ret_cancel_pesq "volta_grid";
  3054.    }
  3055.    else
  3056.    {
  3057.        $Ret_cancel_pesq "resumo";
  3058.    }
  3059. ?>
  3060.    <INPUT type="hidden" name="nmgp_opcao" value="<?php echo $Ret_cancel_pesq?>"> 
  3061.    </FORM> 
  3062. <SCRIPT type="text/javascript">
  3063. <?php
  3064.    if (empty($this->NM_fil_ant))
  3065.    {
  3066.        if ($_SESSION['scriptcase']['proc_mobile'])
  3067.        {
  3068. ?>
  3069.       document.getElementById('Apaga_filters_bot').style.display = 'none';
  3070.       document.getElementById('sel_recup_filters_bot').style.display = 'none';
  3071. <?php
  3072.        }
  3073.        else
  3074.        {
  3075. ?>
  3076.       document.getElementById('Apaga_filters_bot').style.display = 'none';
  3077.       document.getElementById('sel_recup_filters_bot').style.display = 'none';
  3078. <?php
  3079.        }
  3080.    }
  3081. ?>
  3082.  function nm_move()
  3083.  {
  3084.      document.form_cancel.target = "_self"; 
  3085.      document.form_cancel.action = "./"; 
  3086.      document.form_cancel.submit(); 
  3087.  }
  3088.  function nm_submit_form()
  3089.  {
  3090.     document.F1.submit();
  3091.  }
  3092.  function limpa_form()
  3093.  {
  3094.    document.F1.reset();
  3095.    if (document.F1.NM_filters)
  3096.    {
  3097.        document.F1.NM_filters.selectedIndex = -1;
  3098.    }
  3099.    document.getElementById('Salvar_filters_bot').style.display = 'none';
  3100.    document.F1.proprietarios_idproprietario_cond.value = 'gt';
  3101.    nm_campos_between(document.getElementById('id_vis_proprietarios_idproprietario'), document.F1.proprietarios_idproprietario_cond, 'proprietarios_idproprietario');
  3102.    document.F1.proprietarios_idproprietario.value = "";
  3103.    document.F1.proprietarios_nome_cond.value = 'qp';
  3104.    nm_campos_between(document.getElementById('id_vis_proprietarios_nome'), document.F1.proprietarios_nome_cond, 'proprietarios_nome');
  3105.    document.F1.proprietarios_nome.value = "";
  3106.    document.F1.proprietarios_nome_autocomp.value = "";
  3107.    document.F1.proprietarios_sexo_cond.value = 'qp';
  3108.    nm_campos_between(document.getElementById('id_vis_proprietarios_sexo'), document.F1.proprietarios_sexo_cond, 'proprietarios_sexo');
  3109.    document.F1.proprietarios_sexo.value = "";
  3110.    document.F1.proprietarios_sexo_autocomp.value = "";
  3111.    document.F1.proprietarios_cpf_cond.value = 'gt';
  3112.    nm_campos_between(document.getElementById('id_vis_proprietarios_cpf'), document.F1.proprietarios_cpf_cond, 'proprietarios_cpf');
  3113.    document.F1.proprietarios_cpf.value = "";
  3114.  }
  3115.  function SC_carga_evt_jquery()
  3116.  {
  3117.  }
  3118.    function process_hotkeys(hotkey)
  3119.    {
  3120.       if (hotkey == 'sys_format_fi2') { 
  3121.          var output =  $('#sc_b_pesq_bot').click();
  3122.          return (0 < output.length);
  3123.       }
  3124.       if (hotkey == 'sys_format_lim') { 
  3125.          var output =  $('#limpa_frm_bot').click();
  3126.          return (0 < output.length);
  3127.       }
  3128.       if (hotkey == 'sys_format_edi') { 
  3129.          var output =  $('#Ativa_save_bot').click();
  3130.          return (0 < output.length);
  3131.       }
  3132.       if (hotkey == 'sys_format_webh') { 
  3133.          var output =  $('#sc_b_help_bot').click();
  3134.          return (0 < output.length);
  3135.       }
  3136.       if (hotkey == 'sys_format_sai') { 
  3137.          var output =  $('#sc_b_cancel_bot').click();
  3138.          return (0 < output.length);
  3139.       }
  3140.    return false;
  3141.    }
  3142. </SCRIPT>
  3143. </BODY>
  3144. </HTML>
  3145. <?php
  3146.    }

  3147.    function gera_array_filtros()
  3148.    {
  3149.        $this->NM_fil_ant = array();
  3150.        $NM_patch   "Projeto7/grid_new";
  3151.        if (is_dir($this->NM_path_filter $NM_patch))
  3152.        {
  3153.            $NM_dir = @opendir($this->NM_path_filter $NM_patch);
  3154.            while (FALSE !== ($NM_arq = @readdir($NM_dir)))
  3155.            {
  3156.              if (@is_file($this->NM_path_filter $NM_patch "/" $NM_arq))
  3157.              {
  3158.                  $Sc_v6 false;
  3159.                  $NMcmp_filter file($this->NM_path_filter $NM_patch "/" $NM_arq);
  3160.                  $NMcmp_filter explode("@NMF@"$NMcmp_filter[0]);
  3161.                  if (substr($NMcmp_filter[0], 06) == "SC_V6_" || substr($NMcmp_filter[0], 06) == "SC_V8_")
  3162.                  {
  3163.                      $Name_filter substr($NMcmp_filter[0], 6);
  3164.                      if (!empty($Name_filter))
  3165.                      {
  3166.                          $nmgp_save_name str_replace('/'' '$Name_filter);
  3167.                          $nmgp_save_name str_replace('\\'' '$nmgp_save_name);
  3168.                          $nmgp_save_name str_replace('.'' '$nmgp_save_name);
  3169.                          $this->NM_fil_ant[$Name_filter][0] = $NM_patch "/" $nmgp_save_name;
  3170.                          $this->NM_fil_ant[$Name_filter][1] = "" $this->Ini->Nm_lang['lang_srch_public'] . "";
  3171.                          $Sc_v6 true;
  3172.                      }
  3173.                  }
  3174.                  if (!$Sc_v6)
  3175.                  {
  3176.                      $this->NM_fil_ant[$NM_arq][0] = $NM_patch "/" $NM_arq;
  3177.                      $this->NM_fil_ant[$NM_arq][1] = "" $this->Ini->Nm_lang['lang_srch_public'] . "";
  3178.                  }
  3179.              }
  3180.            }
  3181.        }
  3182.        return $this->NM_fil_ant;
  3183.    }
  3184.    /**
  3185.     * @access  public
  3186.     * @param  string  $NM_operador  $this->Ini->Nm_lang['pesq_global_NM_operador']
  3187.     * @param  array  $nmgp_tab_label  
  3188.     */
  3189.    function inicializa_vars()
  3190.    {
  3191.       global $NM_operador$nmgp_tab_label;

  3192.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/");  
  3193.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1);  
  3194.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz;
  3195.       $this->Campos_Mens_erro ""
  3196.       $this->nm_data = new nm_data("en_us");
  3197.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] = "";
  3198.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  3199.       {
  3200.           $nmgp_tab_label $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pesq_tab_label'];
  3201.       }
  3202.       if (!empty($nmgp_tab_label))
  3203.       {
  3204.          $nm_tab_campos explode("?@?"$nmgp_tab_label);
  3205.          $nmgp_tab_label = array();
  3206.          foreach ($nm_tab_campos as $cada_campo)
  3207.          {
  3208.              $parte_campo explode("?#?"$cada_campo);
  3209.              $nmgp_tab_label[$parte_campo[0]] = $parte_campo[1];
  3210.          }
  3211.       }
  3212.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig']))
  3213.       {
  3214.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'] = "";
  3215.       }
  3216.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  3217.       {
  3218.           $this->comando "";
  3219.       }
  3220.       else
  3221.       {
  3222.           $this->comando $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  3223.       }
  3224.       $this->comando_sum    "";
  3225.       $this->comando_filtro "";
  3226.       $this->comando_ini    "ini";
  3227.       $this->comando_fim    "";
  3228.       $this->NM_operador    = (isset($NM_operador) && ("and" == strtolower($NM_operador) || "or" == strtolower($NM_operador))) ? $NM_operador "and";
  3229.    }

  3230.    function salva_filtro($nmgp_save_origem)
  3231.    {
  3232.       global $NM_filters_save$nmgp_save_name$nmgp_save_option$script_case_init;
  3233.           $NM_filters_save str_replace("__NM_PLUS__""+"$NM_filters_save);
  3234.           $NM_str_filter  "SC_V8_" $nmgp_save_name "@NMF@";
  3235.           $nmgp_save_name str_replace('/'' '$nmgp_save_name);
  3236.           $nmgp_save_name str_replace('\\'' '$nmgp_save_name);
  3237.           $nmgp_save_name str_replace('.'' '$nmgp_save_name);
  3238.           if (!NM_is_utf8($nmgp_save_name))
  3239.           {
  3240.               $nmgp_save_name sc_convert_encoding($nmgp_save_name"UTF-8"$_SESSION['scriptcase']['charset']);
  3241.           }
  3242.           $NM_str_filter  .= $NM_filters_save;
  3243.           $NM_patch $this->NM_path_filter;
  3244.           if (!is_dir($NM_patch))
  3245.           {
  3246.               $NMdir mkdir($NM_patch0755);
  3247.           }
  3248.           $NM_patch .= "Projeto7/";
  3249.           if (!is_dir($NM_patch))
  3250.           {
  3251.               $NMdir mkdir($NM_patch0755);
  3252.           }
  3253.           $NM_patch .= "grid_new/";
  3254.           if (!is_dir($NM_patch))
  3255.           {
  3256.               $NMdir mkdir($NM_patch0755);
  3257.           }
  3258.           $Parms_usr  "";
  3259.           $NM_filter fopen ($NM_patch $nmgp_save_name'w');
  3260.           if (!NM_is_utf8($NM_str_filter))
  3261.           {
  3262.               $NM_str_filter sc_convert_encoding($NM_str_filter"UTF-8"$_SESSION['scriptcase']['charset']);
  3263.           }
  3264.           fwrite($NM_filter$NM_str_filter);
  3265.           fclose($NM_filter);
  3266.    }
  3267.    function recupera_filtro($NM_filters)
  3268.    {
  3269.       global $NM_operador$script_case_init;
  3270.       $NM_patch $this->NM_path_filter "/" $NM_filters;
  3271.       if (!is_file($NM_patch))
  3272.       {
  3273.           $NM_filters sc_convert_encoding($NM_filters"UTF-8"$_SESSION['scriptcase']['charset']);
  3274.           $NM_patch $this->NM_path_filter "/" $NM_filters;
  3275.       }
  3276.       $return_fields = array();
  3277.       $tp_fields     = array();
  3278.       $tb_fields_esp = array();
  3279.       $old_bi_opcs   = array("TP","HJ","OT","U7","SP","US","MM","UM","AM","PS","SS","P3","PM","P7","CY","LY","YY","M6","M3","M18","M24");
  3280.       $tp_fields['SC_proprietarios_idproprietario_cond'] = 'cond';
  3281.       $tp_fields['SC_proprietarios_idproprietario'] = 'text';
  3282.       $tp_fields['SC_proprietarios_nome_cond'] = 'cond';
  3283.       $tp_fields['SC_proprietarios_nome'] = 'text_aut';
  3284.       $tp_fields['id_ac_proprietarios_nome'] = 'text_aut';
  3285.       $tp_fields['SC_proprietarios_sexo_cond'] = 'cond';
  3286.       $tp_fields['SC_proprietarios_sexo'] = 'text_aut';
  3287.       $tp_fields['id_ac_proprietarios_sexo'] = 'text_aut';
  3288.       $tp_fields['SC_proprietarios_cpf_cond'] = 'cond';
  3289.       $tp_fields['SC_proprietarios_cpf'] = 'text';
  3290.       $tp_fields['SC_NM_operador'] = 'text';
  3291.       if (is_file($NM_patch))
  3292.       {
  3293.           $SC_V8    false;
  3294.           $NMfilter file($NM_patch);
  3295.           $NMcmp_filter explode("@NMF@"$NMfilter[0]);
  3296.           if (substr($NMcmp_filter[0], 05) == "SC_V8")
  3297.           {
  3298.               $SC_V8 true;
  3299.           }
  3300.           if (substr($NMcmp_filter[0], 05) == "SC_V6" || substr($NMcmp_filter[0], 05) == "SC_V8")
  3301.           {
  3302.               unset($NMcmp_filter[0]);
  3303.           }
  3304.           foreach ($NMcmp_filter as $Cada_cmp)
  3305.           {
  3306.               $Cada_cmp explode("#NMF#"$Cada_cmp);
  3307.               if (isset($tb_fields_esp[$Cada_cmp[0]]))
  3308.               {
  3309.                   $Cada_cmp[0] = $tb_fields_esp[$Cada_cmp[0]];
  3310.               }
  3311.               if (!$SC_V8 && substr($Cada_cmp[0], 011) != "div_ac_lab_" && substr($Cada_cmp[0], 06) != "id_ac_")
  3312.               {
  3313.                   $Cada_cmp[0] = "SC_" $Cada_cmp[0];
  3314.               }
  3315.               if (!isset($tp_fields[$Cada_cmp[0]]))
  3316.               {
  3317.                   continue;
  3318.               }
  3319.               $list   = array();
  3320.               $list_a = array();
  3321.               if (substr($Cada_cmp[1], 010) == "_NM_array_")
  3322.               {
  3323.                   if (substr($Cada_cmp[1], 017) == "_NM_array_#NMARR#")
  3324.                   {
  3325.                       $Sc_temp explode("#NMARR#"substr($Cada_cmp[1], 17));
  3326.                       foreach ($Sc_temp as $Cada_val)
  3327.                       {
  3328.                           $list[]   = $Cada_val;
  3329.                           $tmp_pos  strpos($Cada_val"##@@");
  3330.                           $val_a    = ($tmp_pos !== false) ?  substr($Cada_val$tmp_pos 4) : $Cada_val;
  3331.                           $list_a[] = array('opt' => $Cada_val'value' => $val_a);
  3332.                       }
  3333.                   }
  3334.               }
  3335.               elseif ($tp_fields[$Cada_cmp[0]] == 'dselect')
  3336.               {
  3337.                   $list[]   = $Cada_cmp[1];
  3338.                   $tmp_pos  strpos($Cada_cmp[1], "##@@");
  3339.                   $val_a    = ($tmp_pos !== false) ?  substr($Cada_cmp[1], $tmp_pos 4) : $Cada_cmp[1];
  3340.                   $list_a[] = array('opt' => $Cada_cmp[1], 'value' => $val_a);
  3341.               }
  3342.               else
  3343.               {
  3344.                   $list[0] = $Cada_cmp[1];
  3345.               }
  3346.               if ($tp_fields[$Cada_cmp[0]] == 'select2_aut')
  3347.               {
  3348.                   if (!isset($list[0]))
  3349.                   {
  3350.                       $list[0] = "";
  3351.                   }
  3352.                   $return_fields['set_select2_aut'][] = array('field' => $Cada_cmp[0], 'value' => $list[0]);
  3353.               }
  3354.               elseif ($tp_fields[$Cada_cmp[0]] == 'dselect')
  3355.               {
  3356.                   $return_fields['set_dselect'][] = array('field' => $Cada_cmp[0], 'value' => $list_a);
  3357.               }
  3358.               elseif ($tp_fields[$Cada_cmp[0]] == 'fil_order')
  3359.               {
  3360.                   $return_fields['set_fil_order'][] = array('field' => $Cada_cmp[0], 'value' => $list);
  3361.               }
  3362.               elseif ($tp_fields[$Cada_cmp[0]] == 'selmult')
  3363.               {
  3364.                   if (count($list) == && $list[0] == "")
  3365.                   {
  3366.                       continue;
  3367.                   }
  3368.                   $return_fields['set_selmult'][] = array('field' => $Cada_cmp[0], 'value' => $list);
  3369.               }
  3370.               elseif ($tp_fields[$Cada_cmp[0]] == 'ddcheckbox')
  3371.               {
  3372.                   $return_fields['set_ddcheckbox'][] = array('field' => $Cada_cmp[0], 'value' => $list);
  3373.               }
  3374.               elseif ($tp_fields[$Cada_cmp[0]] == 'checkbox')
  3375.               {
  3376.                   $return_fields['set_checkbox'][] = array('field' => $Cada_cmp[0], 'value' => $list);
  3377.               }
  3378.               else
  3379.               {
  3380.                   if (!isset($list[0]))
  3381.                   {
  3382.                       $list[0] = "";
  3383.                   }
  3384.                   if ($tp_fields[$Cada_cmp[0]] == 'html')
  3385.                   {
  3386.                       $return_fields['set_html'][] = array('field' => $Cada_cmp[0], 'value' => $list[0]);
  3387.                   }
  3388.                   elseif ($tp_fields[$Cada_cmp[0]] == 'radio')
  3389.                   {
  3390.                       $return_fields['set_radio'][] = array('field' => $Cada_cmp[0], 'value' => $list[0]);
  3391.                   }
  3392.                   elseif ($tp_fields[$Cada_cmp[0]] == 'cond' && in_array($list[0], $old_bi_opcs))
  3393.                   {
  3394.                       $Cada_cmp[1] = "bi_" $list[0];
  3395.                       $return_fields['set_val'][] = array('field' => $Cada_cmp[0], 'value' => $Cada_cmp[1]);
  3396.                   }
  3397.                   else
  3398.                   {
  3399.                       $return_fields['set_val'][] = array('field' => $Cada_cmp[0], 'value' => $list[0]);
  3400.                   }
  3401.               }
  3402.           }
  3403.           $this->NM_curr_fil $NM_filters;
  3404.       }
  3405.       return $return_fields;
  3406.    }
  3407.    function apaga_filtro()
  3408.    {
  3409.       global $NM_filters_del;
  3410.       if (isset($NM_filters_del) && !empty($NM_filters_del))
  3411.       { 
  3412.           $NM_patch $this->NM_path_filter "/" $NM_filters_del;
  3413.           if (!is_file($NM_patch))
  3414.           {
  3415.               $NM_filters_del sc_convert_encoding($NM_filters_del"UTF-8"$_SESSION['scriptcase']['charset']);
  3416.               $NM_patch $this->NM_path_filter "/" $NM_filters_del;
  3417.           }
  3418.           if (is_file($NM_patch))
  3419.           {
  3420.               @unlink($NM_patch);
  3421.           }
  3422.           if ($NM_filters_del == $this->NM_curr_fil)
  3423.           {
  3424.               $this->NM_curr_fil "";
  3425.           }
  3426.       }
  3427.    }
  3428.    /**
  3429.     * @access  public
  3430.     */
  3431.    function trata_campos()
  3432.    {
  3433.       global $proprietarios_idproprietario_cond$proprietarios_idproprietario,
  3434.              $proprietarios_nome_cond$proprietarios_nome$proprietarios_nome_autocomp,
  3435.              $proprietarios_sexo_cond$proprietarios_sexo$proprietarios_sexo_autocomp,
  3436.              $proprietarios_cpf_cond$proprietarios_cpf$nmgp_tab_label;

  3437.       $C_formatado true;
  3438.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  3439.       {
  3440.           if ($this->NM_ajax_opcao == "ajax_grid_search")
  3441.           {
  3442.               $C_formatado false;
  3443.           }
  3444.           $Temp_Busca  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'];
  3445.           if ($_SESSION['scriptcase']['charset'] != "UTF-8" && $this->NM_ajax_opcao != "ajax_grid_search_change_fil")
  3446.           {
  3447.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = NM_conv_charset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'], $_SESSION['scriptcase']['charset'], "UTF-8");
  3448.           }
  3449.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] as $Cmps => $Vals)
  3450.           {
  3451.               $$Cmps $Vals;
  3452.           }
  3453.       }
  3454.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_gp_limpa.php""F""nm_limpa_valor") ; 
  3455.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_conv_dados.php""F""nm_conv_limpa_dado") ; 
  3456.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_edit.php""F""nmgp_Form_Num_Val") ; 
  3457.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'] = array();
  3458.       if (!empty($proprietarios_nome_autocomp) && empty($proprietarios_nome))
  3459.       {
  3460.           $proprietarios_nome $proprietarios_nome_autocomp;
  3461.       }
  3462.       if (!empty($proprietarios_sexo_autocomp) && empty($proprietarios_sexo))
  3463.       {
  3464.           $proprietarios_sexo $proprietarios_sexo_autocomp;
  3465.       }
  3466.       $proprietarios_idproprietario_cond_salva $proprietarios_idproprietario_cond
  3467.       if (!isset($proprietarios_idproprietario_input_2) || $proprietarios_idproprietario_input_2 == "")
  3468.       {
  3469.           $proprietarios_idproprietario_input_2 $proprietarios_idproprietario;
  3470.       }
  3471.       $proprietarios_nome_cond_salva $proprietarios_nome_cond
  3472.       if (!isset($proprietarios_nome_input_2) || $proprietarios_nome_input_2 == "")
  3473.       {
  3474.           $proprietarios_nome_input_2 $proprietarios_nome;
  3475.       }
  3476.       $proprietarios_sexo_cond_salva $proprietarios_sexo_cond
  3477.       if (!isset($proprietarios_sexo_input_2) || $proprietarios_sexo_input_2 == "")
  3478.       {
  3479.           $proprietarios_sexo_input_2 $proprietarios_sexo;
  3480.       }
  3481.       $proprietarios_cpf_cond_salva $proprietarios_cpf_cond
  3482.       if (!isset($proprietarios_cpf_input_2) || $proprietarios_cpf_input_2 == "")
  3483.       {
  3484.           $proprietarios_cpf_input_2 $proprietarios_cpf;
  3485.       }
  3486.       if ($proprietarios_idproprietario_cond != "in")
  3487.       {
  3488.           nm_limpa_numero($proprietarios_idproprietario$_SESSION['scriptcase']['reg_conf']['grup_num']) ; 
  3489.       }
  3490.       else
  3491.       {
  3492.           $Nm_sc_valores explode(","$proprietarios_idproprietario);
  3493.           foreach ($Nm_sc_valores as $II => $Nm_sc_valor)
  3494.           {
  3495.               $Nm_sc_valor trim($Nm_sc_valor);
  3496.               nm_limpa_numero($Nm_sc_valor$_SESSION['scriptcase']['reg_conf']['grup_num']); 
  3497.               $Nm_sc_valores[$II] = $Nm_sc_valor;
  3498.           }
  3499.           $proprietarios_idproprietario implode(","$Nm_sc_valores);
  3500.       }
  3501.       if ($proprietarios_cpf_cond != "in")
  3502.       {
  3503.           nm_limpa_numero($proprietarios_cpf$_SESSION['scriptcase']['reg_conf']['grup_num']) ; 
  3504.       }
  3505.       else
  3506.       {
  3507.           $Nm_sc_valores explode(","$proprietarios_cpf);
  3508.           foreach ($Nm_sc_valores as $II => $Nm_sc_valor)
  3509.           {
  3510.               $Nm_sc_valor trim($Nm_sc_valor);
  3511.               nm_limpa_numero($Nm_sc_valor$_SESSION['scriptcase']['reg_conf']['grup_num']); 
  3512.               $Nm_sc_valores[$II] = $Nm_sc_valor;
  3513.           }
  3514.           $proprietarios_cpf implode(","$Nm_sc_valores);
  3515.       }
  3516.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']  = array(); 
  3517.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search']  = array(); 
  3518.       $I_Grid 0;
  3519.       $Dyn_ok false;
  3520.       $Grid_ok false;
  3521.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_idproprietario'] = $proprietarios_idproprietario
  3522.       if (is_array($proprietarios_idproprietario) && !empty($proprietarios_idproprietario))
  3523.       {
  3524.           $Grid_ok true;
  3525.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0] = $proprietarios_idproprietario;
  3526.       }
  3527.       elseif ($proprietarios_idproprietario_cond_salva == "nu" || $proprietarios_idproprietario_cond_salva == "nn" || $proprietarios_idproprietario_cond_salva == "ep" || $proprietarios_idproprietario_cond_salva == "ne" ||  !empty($proprietarios_idproprietario))
  3528.       {
  3529.           $Grid_ok true;
  3530.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0][0] = $proprietarios_idproprietario;
  3531.       }
  3532.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_idproprietario_cond'] = $proprietarios_idproprietario_cond_salva
  3533.       if ($Grid_ok)
  3534.       {
  3535.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['cmp'] = "proprietarios_idproprietario"
  3536.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['opc'] = $proprietarios_idproprietario_cond_salva
  3537.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']['proprietarios_idproprietario'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid];
  3538.           $I_Grid++;
  3539.       }
  3540.       $Dyn_ok false;
  3541.       $Grid_ok false;
  3542.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_nome'] = $proprietarios_nome
  3543.       if (is_array($proprietarios_nome) && !empty($proprietarios_nome))
  3544.       {
  3545.           $Grid_ok true;
  3546.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0] = $proprietarios_nome;
  3547.       }
  3548.       elseif ($proprietarios_nome_cond_salva == "nu" || $proprietarios_nome_cond_salva == "nn" || $proprietarios_nome_cond_salva == "ep" || $proprietarios_nome_cond_salva == "ne" ||  !empty($proprietarios_nome))
  3549.       {
  3550.           $Grid_ok true;
  3551.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0][0] = $proprietarios_nome;
  3552.       }
  3553.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_nome_cond'] = $proprietarios_nome_cond_salva
  3554.       if ($Grid_ok)
  3555.       {
  3556.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['cmp'] = "proprietarios_nome"
  3557.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['opc'] = $proprietarios_nome_cond_salva
  3558.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']['proprietarios_nome'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid];
  3559.           $I_Grid++;
  3560.       }
  3561.       $Dyn_ok false;
  3562.       $Grid_ok false;
  3563.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_sexo'] = $proprietarios_sexo
  3564.       if (is_array($proprietarios_sexo) && !empty($proprietarios_sexo))
  3565.       {
  3566.           $Grid_ok true;
  3567.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0] = $proprietarios_sexo;
  3568.       }
  3569.       elseif ($proprietarios_sexo_cond_salva == "nu" || $proprietarios_sexo_cond_salva == "nn" || $proprietarios_sexo_cond_salva == "ep" || $proprietarios_sexo_cond_salva == "ne" ||  !empty($proprietarios_sexo))
  3570.       {
  3571.           $Grid_ok true;
  3572.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0][0] = $proprietarios_sexo;
  3573.       }
  3574.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_sexo_cond'] = $proprietarios_sexo_cond_salva
  3575.       if ($Grid_ok)
  3576.       {
  3577.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['cmp'] = "proprietarios_sexo"
  3578.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['opc'] = $proprietarios_sexo_cond_salva
  3579.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']['proprietarios_sexo'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid];
  3580.           $I_Grid++;
  3581.       }
  3582.       $Dyn_ok false;
  3583.       $Grid_ok false;
  3584.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_cpf'] = $proprietarios_cpf
  3585.       if (is_array($proprietarios_cpf) && !empty($proprietarios_cpf))
  3586.       {
  3587.           $Grid_ok true;
  3588.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0] = $proprietarios_cpf;
  3589.       }
  3590.       elseif ($proprietarios_cpf_cond_salva == "nu" || $proprietarios_cpf_cond_salva == "nn" || $proprietarios_cpf_cond_salva == "ep" || $proprietarios_cpf_cond_salva == "ne" ||  !empty($proprietarios_cpf))
  3591.       {
  3592.           $Grid_ok true;
  3593.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['val'][0][0] = $proprietarios_cpf;
  3594.       }
  3595.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['proprietarios_cpf_cond'] = $proprietarios_cpf_cond_salva
  3596.       if ($Grid_ok)
  3597.       {
  3598.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['cmp'] = "proprietarios_cpf"
  3599.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid]['opc'] = $proprietarios_cpf_cond_salva
  3600.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']['proprietarios_cpf'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Grid_search'][$I_Grid];
  3601.           $I_Grid++;
  3602.       }
  3603.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']['NM_operador'] = $this->NM_operador
  3604.       if ($this->NM_ajax_flag && $this->NM_ajax_opcao == "ajax_grid_search")
  3605.       {
  3606.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = $Temp_Busca;
  3607.       }
  3608.       if (!empty($this->Campos_Mens_erro)) 
  3609.       {
  3610.           return;
  3611.       }
  3612.       $Conteudo $proprietarios_idproprietario;
  3613.       if (strtoupper($proprietarios_idproprietario_cond) != "II" && strtoupper($proprietarios_idproprietario_cond) != "QP" && strtoupper($proprietarios_idproprietario_cond) != "NP" && strtoupper($proprietarios_idproprietario_cond) != "IN"
  3614.       { 
  3615.           nmgp_Form_Num_Val($Conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  3616.       } 
  3617.       $this->cmp_formatado['proprietarios_idproprietario'] = $Conteudo;
  3618.       $proprietarios_nome_look substr($this->Db->qstr($proprietarios_nome), 1, -1); 
  3619.       $nmgp_def_dados = array(); 
  3620.       $nm_comando "select distinct Proprietarios.Nome from " $this->Ini->nm_tabela " where Proprietarios.Nome = '$proprietarios_nome_look' order by Proprietarios.Nome"
  3621.       unset($cmp1,$cmp2);
  3622.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  3623.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  3624.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  3625.       { 
  3626.          while (!$rs->EOF
  3627.          { 
  3628.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  3629.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  3630.             $rs->MoveNext() ; 
  3631.          } 
  3632.          $rs->Close() ; 
  3633.       } 
  3634.       else  
  3635.       {  
  3636.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  3637.          exit; 
  3638.       } 

  3639.       if (!empty($nmgp_def_dados) && isset($cmp2) && !empty($cmp2))
  3640.       {
  3641.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  3642.           {
  3643.              $cmp2 NM_conv_charset($cmp2$_SESSION['scriptcase']['charset'], "UTF-8");
  3644.           }
  3645.           $this->cmp_formatado['proprietarios_nome'] = $cmp2;
  3646.       }
  3647.       elseif (!empty($nmgp_def_dados) && isset($cmp1) && !empty($cmp1))
  3648.       {
  3649.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  3650.           {
  3651.              $cmp1 NM_conv_charset($cmp1$_SESSION['scriptcase']['charset'], "UTF-8");
  3652.           }
  3653.           $this->cmp_formatado['proprietarios_nome'] = $cmp1;
  3654.       }
  3655.       else
  3656.       {
  3657.           $this->cmp_formatado['proprietarios_nome'] = $proprietarios_nome;
  3658.       }
  3659.       $proprietarios_sexo_look substr($this->Db->qstr($proprietarios_sexo), 1, -1); 
  3660.       $nmgp_def_dados = array(); 
  3661.       $nm_comando "select distinct Proprietarios.Sexo from " $this->Ini->nm_tabela " where Proprietarios.Sexo = '$proprietarios_sexo_look' order by Proprietarios.Sexo"
  3662.       unset($cmp1,$cmp2);
  3663.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando
  3664.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  3665.       if ($rs $this->Db->SelectLimit($nm_comando100)) 
  3666.       { 
  3667.          while (!$rs->EOF
  3668.          { 
  3669.             $cmp1 NM_charset_to_utf8(trim($rs->fields[0]));
  3670.             $nmgp_def_dados[] = array($cmp1 => $cmp1); 
  3671.             $rs->MoveNext() ; 
  3672.          } 
  3673.          $rs->Close() ; 
  3674.       } 
  3675.       else  
  3676.       {  
  3677.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  3678.          exit; 
  3679.       } 

  3680.       if (!empty($nmgp_def_dados) && isset($cmp2) && !empty($cmp2))
  3681.       {
  3682.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  3683.           {
  3684.              $cmp2 NM_conv_charset($cmp2$_SESSION['scriptcase']['charset'], "UTF-8");
  3685.           }
  3686.           $this->cmp_formatado['proprietarios_sexo'] = $cmp2;
  3687.       }
  3688.       elseif (!empty($nmgp_def_dados) && isset($cmp1) && !empty($cmp1))
  3689.       {
  3690.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  3691.           {
  3692.              $cmp1 NM_conv_charset($cmp1$_SESSION['scriptcase']['charset'], "UTF-8");
  3693.           }
  3694.           $this->cmp_formatado['proprietarios_sexo'] = $cmp1;
  3695.       }
  3696.       else
  3697.       {
  3698.           $this->cmp_formatado['proprietarios_sexo'] = $proprietarios_sexo;
  3699.       }
  3700.       $Conteudo $proprietarios_cpf;
  3701.       if (strtoupper($proprietarios_cpf_cond) != "II" && strtoupper($proprietarios_cpf_cond) != "QP" && strtoupper($proprietarios_cpf_cond) != "NP" && strtoupper($proprietarios_cpf_cond) != "IN"
  3702.       { 
  3703.           nmgp_Form_Num_Val($Conteudo$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""1""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  3704.       } 
  3705.       $this->cmp_formatado['proprietarios_cpf'] = $Conteudo;

  3706.       //----- $proprietarios_idproprietario
  3707.       $this->Date_part false;
  3708.       if (isset($proprietarios_idproprietario) || $proprietarios_idproprietario_cond == "nu" || $proprietarios_idproprietario_cond == "nn" || $proprietarios_idproprietario_cond == "ep" || $proprietarios_idproprietario_cond == "ne")
  3709.       {
  3710.          $this->monta_condicao("Proprietarios.idProprietario"$proprietarios_idproprietario_cond$proprietarios_idproprietario"""proprietarios_idproprietario");
  3711.       }

  3712.       //----- $proprietarios_nome
  3713.       $this->Date_part false;
  3714.       if (isset($proprietarios_nome) || $proprietarios_nome_cond == "nu" || $proprietarios_nome_cond == "nn" || $proprietarios_nome_cond == "ep" || $proprietarios_nome_cond == "ne")
  3715.       {
  3716.          $this->monta_condicao("Proprietarios.Nome"$proprietarios_nome_cond$proprietarios_nome"""proprietarios_nome");
  3717.       }

  3718.       //----- $proprietarios_sexo
  3719.       $this->Date_part false;
  3720.       if (isset($proprietarios_sexo) || $proprietarios_sexo_cond == "nu" || $proprietarios_sexo_cond == "nn" || $proprietarios_sexo_cond == "ep" || $proprietarios_sexo_cond == "ne")
  3721.       {
  3722.          $this->monta_condicao("Proprietarios.Sexo"$proprietarios_sexo_cond$proprietarios_sexo"""proprietarios_sexo");
  3723.       }

  3724.       //----- $proprietarios_cpf
  3725.       $this->Date_part false;
  3726.       if (isset($proprietarios_cpf) || $proprietarios_cpf_cond == "nu" || $proprietarios_cpf_cond == "nn" || $proprietarios_cpf_cond == "ep" || $proprietarios_cpf_cond == "ne")
  3727.       {
  3728.          $this->monta_condicao("Proprietarios.Cpf"$proprietarios_cpf_cond$proprietarios_cpf"""proprietarios_cpf");
  3729.       }
  3730.    }

  3731.    /**
  3732.     * @access  public
  3733.     */
  3734.    function finaliza_resultado_ajax()
  3735.    {
  3736.        $this->comando substr($this->comando8);
  3737.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_grid'] = $this->comando;
  3738.        if (empty($this->comando)) 
  3739.        {
  3740.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = "";
  3741.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']        = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  3742.        }
  3743.        else
  3744.        {
  3745.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = "( " $this->comando " )";
  3746.            if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'])) 
  3747.            {
  3748.                $this->comando $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'] . " and (" $this->comando ")"
  3749.            }
  3750.            else
  3751.            {
  3752.                $this->comando " where " $this->comando
  3753.            }
  3754.            $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] = $this->comando;
  3755.        }
  3756.        if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'])) 
  3757.        {
  3758.            if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'])) 
  3759.            {
  3760.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] .= " and (" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'] . ")";
  3761.            }
  3762.            else 
  3763.            {
  3764.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] = " where (" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'] . ")";
  3765.            }
  3766.        }
  3767.    }
  3768.    function finaliza_resultado()
  3769.    {
  3770.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dyn_search']      = array();
  3771.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_dyn_search'] = "";
  3772.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'] = "";
  3773.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search']);
  3774.       if ("" == $this->comando_filtro)
  3775.       {
  3776.           $this->comando $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  3777.       }
  3778.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && $_SESSION['scriptcase']['charset'] != "UTF-8")
  3779.       {
  3780.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'] = NM_conv_charset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'], "UTF-8"$_SESSION['scriptcase']['charset']);
  3781.       }

  3782.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_grid']    = $this->comando_filtro;
  3783.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_lookup']  = $this->comando_sum $this->comando_fim;
  3784.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']         = $this->comando $this->comando_fim;
  3785.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']              = "pesq";
  3786.       if ("" == $this->comando_filtro)
  3787.       {
  3788.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = "";
  3789.       }
  3790.       else
  3791.       {
  3792.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = " (" $this->comando_filtro ")";
  3793.       }
  3794.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] != $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'])
  3795.       {
  3796.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] .= $this->NM_operador;
  3797.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_array_resumo'] = "NAO";
  3798.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral']  = "NAO";
  3799.          unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral']);
  3800.       }
  3801.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];

  3802.       if ($this->NM_ajax_flag && ($this->NM_ajax_opcao == "ajax_grid_search" || $this->NM_ajax_opcao == "ajax_grid_search_change_fil"))
  3803.       {
  3804.          return;
  3805.       }
  3806.       $this->retorna_pesq();
  3807.    }
  3808.    function nm_gera_mask(&$nm_campo$nm_mask)
  3809.    { 
  3810.       $trab_campo $nm_campo;
  3811.       $trab_mask  $nm_mask;
  3812.       $tam_campo  strlen($nm_campo);
  3813.       $trab_saida "";
  3814.       $mask_num false;
  3815.       for ($x=0$x strlen($trab_mask); $x++)
  3816.       {
  3817.           if (substr($trab_mask$x1) == "#")
  3818.           {
  3819.               $mask_num true;
  3820.               break;
  3821.           }
  3822.       }
  3823.       if ($mask_num )
  3824.       {
  3825.           $ver_duas explode(";"$trab_mask);
  3826.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  3827.           {
  3828.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  3829.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  3830.               if ($cont2 >= $tam_campo)
  3831.               {
  3832.                   $trab_mask $ver_duas[1];
  3833.               }
  3834.               else
  3835.               {
  3836.                   $trab_mask $ver_duas[0];
  3837.               }
  3838.           }
  3839.           $tam_mask strlen($trab_mask);
  3840.           $xdados 0;
  3841.           for ($x=0$x $tam_mask$x++)
  3842.           {
  3843.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  3844.               {
  3845.                   $trab_saida .= substr($trab_campo$xdados1);
  3846.                   $xdados++;
  3847.               }
  3848.               elseif ($xdados $tam_campo)
  3849.               {
  3850.                   $trab_saida .= substr($trab_mask$x1);
  3851.               }
  3852.           }
  3853.           if ($xdados $tam_campo)
  3854.           {
  3855.               $trab_saida .= substr($trab_campo$xdados);
  3856.           }
  3857.           $nm_campo $trab_saida;
  3858.           return;
  3859.       }
  3860.       for ($ix strlen($trab_mask); $ix 0$ix--)
  3861.       {
  3862.            $char_mask substr($trab_mask$ix 11);
  3863.            if ($char_mask != "x" && $char_mask != "z")
  3864.            {
  3865.                $trab_saida $char_mask $trab_saida;
  3866.            }
  3867.            else
  3868.            {
  3869.                if ($tam_campo != 0)
  3870.                {
  3871.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  3872.                    $tam_campo--;
  3873.                }
  3874.                else
  3875.                {
  3876.                    $trab_saida "0" $trab_saida;
  3877.                }
  3878.            }
  3879.       }
  3880.       if ($tam_campo != 0)
  3881.       {
  3882.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  3883.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  3884.       }
  3885.    
  3886.       $iz 0
  3887.       for ($ix 0$ix strlen($trab_mask); $ix++)
  3888.       {
  3889.            $char_mask substr($trab_mask$ix1);
  3890.            if ($char_mask != "x" && $char_mask != "z")
  3891.            {
  3892.                if ($char_mask == "." || $char_mask == ",")
  3893.                {
  3894.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  3895.                }
  3896.                else
  3897.                {
  3898.                    $iz++;
  3899.                }
  3900.            }
  3901.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  3902.            {
  3903.                $ix strlen($trab_mask) + 1;
  3904.            }
  3905.            else
  3906.            {
  3907.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  3908.            }
  3909.       }
  3910.       $nm_campo $trab_saida;
  3911.    } 
  3912.    function nm_conv_data_db($dt_in$form_in$form_out)
  3913.    {
  3914.        $dt_out $dt_in;
  3915.        if (strtoupper($form_in) == "DB_FORMAT")
  3916.        {
  3917.            if ($dt_out == "null" || $dt_out == "")
  3918.            {
  3919.                $dt_out "";
  3920.                return $dt_out;
  3921.            }
  3922.            $form_in "AAAA-MM-DD";
  3923.        }
  3924.        if (strtoupper($form_out) == "DB_FORMAT")
  3925.        {
  3926.            if (empty($dt_out))
  3927.            {
  3928.                $dt_out "null";
  3929.                return $dt_out;
  3930.            }
  3931.            $form_out "AAAA-MM-DD";
  3932.        }
  3933.        nm_conv_form_data($dt_out$form_in$form_out);
  3934.        return $dt_out;
  3935.    }
  3936. }

  3937. ?>
Return
grid_new_res_csv.class.php
  1. <?php

  2. class grid_new_res_csv
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;
  8.    var $nm_data;
  9.    var $array_titulos;
  10.    var $array_linhas;

  11.    var $Arquivo;
  12.    var $Tit_doc;
  13.    var $Delim_dados;
  14.    var $Delim_line;
  15.    var $Delim_col;
  16.    var $sc_proc_grid

  17.    //---- 
  18.    function __construct()
  19.    {
  20.       $this->nm_data   = new nm_data("en_us");
  21.    }

  22.    //---- 
  23.    function monta_csv()
  24.    {
  25.       $this->inicializa_vars();
  26.       $this->grava_arquivo();
  27.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_grid']))
  28.       {
  29.           return;
  30.       }
  31.       if ($this->Ini->sc_export_ajax)
  32.       {
  33.           $this->Arr_result['file_export']  = NM_charset_to_utf8($this->Csv_f);
  34.           $this->Arr_result['title_export'] = NM_charset_to_utf8($this->Tit_doc);
  35.           $Temp ob_get_clean();
  36.           $oJson = new Services_JSON();
  37.           echo $oJson->encode($this->Arr_result);
  38.           exit;
  39.       }
  40.       else
  41.       {
  42.           $this->progress_bar_end();
  43.       }
  44.    }

  45.    //----- 
  46.    function inicializa_vars()
  47.    {
  48.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  49.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  50.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  51.       require_once($this->Ini->path_aplicacao $this->Ini->Apl_resumo); 
  52.       $this->array_titulos = array();
  53.       $this->array_linhas  = array();
  54.       $this->Csv_password  "";
  55.       $this->Arquivo       "sc_csv";
  56.       $this->Arquivo      .= "_" date('YmdHis') . "_" rand(01000);
  57.       $this->Arq_zip       $this->Arquivo "_grid_new.zip";
  58.       $this->Arquivo      .= "_grid_new";
  59.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_grid']))
  60.       {
  61.           $this->Arquivo      .= "_" $this->Ini->Nm_lang['lang_othr_smry_titl'];
  62.       }
  63.       $this->Arquivo      .= ".csv";
  64.       $this->Tit_doc       "grid_new.csv";
  65.       $this->Tit_zip       "grid_new.zip";
  66.       $this->Label_CSV     "N";
  67.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name']))
  68.       {
  69.           $this->Arquivo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'];
  70.           $this->Arq_zip $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'];
  71.           $this->Tit_doc $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'];
  72.           $Pos strrpos($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'], ".");
  73.           if ($Pos !== false) {
  74.               $this->Arq_zip substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name'], 0$Pos);
  75.           }
  76.           $this->Arq_zip .= ".zip";
  77.           $this->Tit_zip  $this->Arq_zip;
  78.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_name']);
  79.       }
  80.       $this->Res           = new grid_new_resumo("out");
  81.       $this->prep_modulos("Res");
  82.       $this->Delim_dados "\"";
  83.       $this->Delim_col   ";";
  84.       $this->Delim_line  "\r\n";
  85.       if (isset($_POST['nm_delim_line']) && !empty($_POST['nm_delim_line']))
  86.       {
  87.           $this->Delim_line str_replace(array(1,2,3), array("\r\n","\r","\n"), $_POST['nm_delim_line']);
  88.       }
  89.       if (isset($_POST['nm_delim_col']) && !empty($_POST['nm_delim_col']))
  90.       {
  91.           $this->Delim_col str_replace(array(1,2,3,4,5), array(";",",","\    ","#",""), $_POST['nm_delim_col']);
  92.       }
  93.       if (isset($_POST['nm_delim_dados']) && !empty($_POST['nm_delim_dados']))
  94.       {
  95.           $this->Delim_dados str_replace(array(1,2,3,4), array('"',"'","","|"), $_POST['nm_delim_dados']);
  96.       }
  97.       if (isset($_POST['nm_label_csv']) && !empty($_POST['nm_label_csv']))
  98.       {
  99.           $this->Label_CSV $_POST['nm_label_csv'];
  100.       }
  101.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_grid']) && !$this->Ini->sc_export_ajax) {
  102.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  103.           $this->pb = new scProgressBar();
  104.           $this->pb->setRoot($this->Ini->root);
  105.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  106.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  107.           $this->pb->initialize();
  108.           $this->pb->setReturnUrl("./");
  109.           $this->pb->setReturnOption($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_return']);
  110.           $this->pb->setTotalSteps(100);
  111.           $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  112.           $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  113.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  114.               $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  115.               $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  116.           }
  117.           $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  118.           $this->pb->addSteps(50);
  119.       }
  120.    }

  121.    //---- 
  122.    function prep_modulos($modulo)
  123.    {
  124.       $this->$modulo->Ini    $this->Ini;
  125.       $this->$modulo->Db     $this->Db;
  126.       $this->$modulo->Erro   $this->Erro;
  127.       $this->$modulo->Lookup $this->Lookup;
  128.    }

  129.    //----- 
  130.    function grava_arquivo()
  131.    {
  132.       $this->Csv_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  133.       $this->Zip_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arq_zip;
  134.       $csv_f       fopen($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo"w");
  135.       $this->Res->resumo_export();
  136.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_grid']) && !$this->Ini->sc_export_ajax) {
  137.           $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  138.           $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  139.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  140.               $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  141.               $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  142.           }
  143.           $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  144.           $this->pb->addSteps(30);
  145.       }
  146.       $this->array_titulos $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['arr_export']['label'];
  147.       $this->array_linhas  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['arr_export']['data'];
  148.       $this->comp_y_axys  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_y_axys'];
  149.       $this->comp_tabular $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_tabular'];
  150.       if (>= sizeof($this->comp_y_axys))
  151.       {
  152.           $this->comp_tabular false;
  153.       }
  154.       if ($this->Label_CSV == "S")
  155.       {
  156.           $this->grava_titulos($csv_f);
  157.       }
  158.       $this->control_lines = array();
  159.       foreach ($this->array_linhas as $lines)
  160.       {
  161.          $this->grava_linha($csv_f$lines);
  162.       }
  163.       fclose($csv_f);
  164.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_grid']))
  165.       {
  166.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_res_file'] = $this->Csv_f;
  167.       }
  168.       elseif ($this->Csv_password != "")
  169.       { 
  170.           $str_zip "";
  171.           $Zip_f = (FALSE !== strpos($this->Zip_f' ')) ? " \"" $this->Zip_f "\"" :  $this->Zip_f;
  172.           $Arq_input   = (FALSE !== strpos($this->Csv_f' ')) ? " \"" $this->Csv_f "\"" :  $this->Csv_f;
  173.           if (is_file($Zip_f)) {
  174.               unlink($Zip_f);
  175.           }
  176.           if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  177.           {
  178.               chdir($this->Ini->path_third "/zip/windows");
  179.               $str_zip "zip.exe -P -j " $this->Csv_password " " $Zip_f " " $Arq_input;
  180.           }
  181.           elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  182.           {
  183.                 if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  184.                 {
  185.                     chdir($this->Ini->path_third "/zip/linux-i386/bin");
  186.                 }
  187.                 else
  188.                 {
  189.                     chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  190.                 }
  191.               $str_zip "./7za -p" $this->Csv_password " a " $Zip_f " " $Arq_input;
  192.           }
  193.           elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  194.           {
  195.               chdir($this->Ini->path_third "/zip/mac/bin");
  196.              $str_zip "./7za -p" $this->Csv_password " a " $Zip_f " " $Arq_input;
  197.           }
  198.           if (!empty($str_zip)) {
  199.               exec($str_zip);
  200.           }
  201.           unlink($Arq_input);
  202.           $this->Arquivo $this->Arq_zip;
  203.           $this->Csv_f   $this->Zip_f;
  204.           $this->Tit_doc $this->Tit_zip;
  205.           // ----- ZIP log
  206.           $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'w');
  207.           if ($fp)
  208.           {
  209.               @fwrite($fp$str_zip "\r\n\r\n");
  210.               @fclose($fp);
  211.           }
  212.       } 
  213.    }

  214.    function grava_titulos($csv_f)
  215.    {
  216.       $b_display false;
  217.       $contr_rowspan = array();
  218.       $contr_colspan = array();
  219.       foreach ($this->array_titulos as $lines)
  220.       {
  221.            $csv_registro "";
  222.            $col 0;
  223.            if (!$b_display)
  224.            {
  225.                $colspan $this->comp_tabular sizeof($this->comp_y_axys) : 1;
  226.                $contr_rowspan[$col] = sizeof($this->array_titulos);
  227.                $contr_colspan[$col] = $colspan;
  228.                $campo_titulo $this->Ini->Nm_lang['lang_othr_smry_msge'];
  229.                if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($campo_titulo))
  230.                {
  231.                    $campo_titulo sc_convert_encoding($campo_titulo"UTF-8"$_SESSION['scriptcase']['charset']);
  232.                }
  233.                $csv_registro .= $this->Delim_dados str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$campo_titulo) . $this->Delim_dados;
  234.                if ($colspan 1)
  235.                {
  236.                    for ($x 1$x $colspan$x++)
  237.                    {
  238.                        $csv_registro .= $this->Delim_col $this->Delim_dados $this->Delim_dados;
  239.                    }
  240.                }
  241.                $b_display true;
  242.                $col += $colspan;
  243.            }
  244.            foreach ($lines as $columns)
  245.            {
  246.                $col_ok false;
  247.                $colspan = (isset($columns['colspan']) && $columns['colspan']) ? $columns['colspan'] : 1;
  248.                while (!$col_ok)
  249.                {
  250.                    $prim true;
  251.                    if (isset($contr_rowspan[$col]) && $contr_rowspan[$col])
  252.                    {
  253.                        $contr_rowspan[$col]--;
  254.                        $col_sp $contr_colspan[$col];
  255.                        for ($x 0$x $col_sp$x++)
  256.                        {
  257.                            if (!$prim)
  258.                            {
  259.                                $csv_registro .= $this->Delim_col;
  260.                            }
  261.                            $csv_registro .= $this->Delim_dados $this->Delim_dados;
  262.                            $col ++;
  263.                            $prim false;
  264.                        }
  265.                    }
  266.                    else
  267.                    {
  268.                        $col_ok true;
  269.                    }
  270.                }
  271.                if (isset($columns['rowspan']) && $columns['rowspan'])
  272.                {
  273.                    $contr_rowspan[$col] = $columns['rowspan'];
  274.                    $contr_colspan[$col] = $colspan;
  275.                }
  276.                $campo_titulo $columns['label'];
  277.                if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($campo_titulo))
  278.                {
  279.                    $campo_titulo sc_convert_encoding($campo_titulo"UTF-8"$_SESSION['scriptcase']['charset']);
  280.                }
  281.                $csv_registro .= $this->Delim_col $this->Delim_dados str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$campo_titulo) . $this->Delim_dados;
  282.                if ($colspan 1)
  283.                {
  284.                    for ($x 1$x $colspan$x++)
  285.                    {
  286.                        $csv_registro .= $this->Delim_col $this->Delim_dados $this->Delim_dados;
  287.                    }
  288.                }
  289.                $col += $colspan;
  290.            }
  291.            foreach ($contr_rowspan as $col_t => $row)
  292.            {
  293.                if ($col_t >= $col && $row 1)
  294.                {
  295.                    $contr_rowspan[$col]--;
  296.                }
  297.            }
  298.            $csv_registro .= $this->Delim_line;
  299.            fwrite($csv_f$csv_registro);
  300.       }
  301.    }
  302.    function grava_linha($csv_f$lines)
  303.    {
  304.        $csv_registro "";
  305.        $prim true;
  306.        $col     0;
  307.        $colspan 0;
  308.        foreach ($lines as $ind => $columns)
  309.        {
  310.            $col $ind $colspan;
  311.            if (isset($columns['colspan']) && $columns['colspan'] > 0)
  312.            {
  313.               $colspan $columns['colspan'] - 1;
  314.            }
  315.            if (<= $columns['level'])
  316.            {
  317.               $cada_dado $columns['label'];
  318.            }
  319.            else
  320.            {
  321.                $cada_dado $columns['value'];
  322.            }
  323.            $cada_dado str_replace("&nbsp;"""$cada_dado);
  324.            if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($cada_dado))
  325.            {
  326.                $cada_dado sc_convert_encoding($cada_dado"UTF-8"$_SESSION['scriptcase']['charset']);
  327.            }
  328.            $cada_dado $this->Delim_dados str_replace($this->Delim_dados$this->Delim_dados $this->Delim_dados$cada_dado) . $this->Delim_dados;
  329.            if ($prim)
  330.            {
  331.                for ($x = ($ind 1); $x count($this->control_lines); $x++)
  332.                {
  333.                    $this->control_lines[$x] = $this->Delim_dados $this->Delim_dados;
  334.                }
  335.                $prim false;
  336.            }
  337.            $this->control_lines[$col] = $cada_dado;
  338.        }
  339.        $csv_registro implode($this->Delim_col$this->control_lines) . $this->Delim_line;
  340.        fwrite($csv_f$csv_registro);
  341.    }

  342.    function nm_conv_data_db($dt_in$form_in$form_out)
  343.    {
  344.        $dt_out $dt_in;
  345.        if (strtoupper($form_in) == "DB_FORMAT")
  346.        {
  347.            if ($dt_out == "null" || $dt_out == "")
  348.            {
  349.                $dt_out "";
  350.                return $dt_out;
  351.            }
  352.            $form_in "AAAA-MM-DD";
  353.        }
  354.        if (strtoupper($form_out) == "DB_FORMAT")
  355.        {
  356.            if (empty($dt_out))
  357.            {
  358.                $dt_out "null";
  359.                return $dt_out;
  360.            }
  361.            $form_out "AAAA-MM-DD";
  362.        }
  363.        nm_conv_form_data($dt_out$form_in$form_out);
  364.        return $dt_out;
  365.    }
  366.    function progress_bar_end()
  367.    {
  368.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_file']);
  369.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  370.       {
  371.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  372.       }
  373.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  374.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  375.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  376.       $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  377.       if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  378.           $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  379.       }
  380.       $this->pb->setProgressbarMessage($Mens_bar);
  381.       $this->pb->setDownloadLink($this->Ini->path_imag_temp "/" $this->Arquivo);
  382.       $this->pb->setDownloadMd5($path_doc_md5);
  383.       $this->pb->completed();
  384.    }
  385.    //---- 
  386.    function monta_html()
  387.    {
  388.       global $nm_url_saida;
  389.       include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  390.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_file']);
  391.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  392.       {
  393.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  394.       }
  395.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  396.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  397.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  398. ?>
  399. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  400.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  401. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  402. <HEAD>
  403.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: CSV</TITLE>
  404.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  405. <?php
  406. if ($_SESSION['scriptcase']['proc_mobile'])
  407. {
  408. ?>
  409.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  410. <?php
  411. }
  412. ?>
  413.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
  414.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?>" GMT">
  415.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
  416.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0">
  417.  <META http-equiv="Pragma" content="no-cache">
  418.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  419.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  420.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  421.  <?php
  422.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  423.  {
  424.  ?>
  425.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  426.  <?php
  427.  }
  428.  ?>
  429.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  430. </HEAD>
  431. <BODY class="scExportPage">
  432. <?php echo $this->Ini->Ajax_result_set ?>
  433. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  434.  <table class="scExportTable" align="center">
  435.   <tr>
  436.    <td class="scExportTitle" style="height: 25px">CSV</td>
  437.   </tr>
  438.   <tr>
  439.    <td class="scExportLine" style="width: 100%">
  440.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  441.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  442.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  443.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  444.  ?>
  445.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  446.  ?>
  447.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  448.  ?>
  449.     </td></tr></table>
  450.    </td>
  451.   </tr>
  452.  </table>
  453. </td></tr></table>
  454. <form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp "/" $this->Arquivo ?>" target="_blank" style="display: none"> 
  455. </form>
  456. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  457. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  458. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  459. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  460. </form>
  461. <FORM name="F0" method=post action="./"> 
  462. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  463. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  464. <INPUT type="hidden" name="nmgp_opcao" value="<?php echo NM_encode_input($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_return']); ?>"> 
  465. </FORM> 
  466. </td></tr></table>
  467. </BODY>
  468. </HTML>
  469. <?php
  470.    }
  471.    function nm_gera_mask(&$nm_campo$nm_mask)
  472.    { 
  473.       $trab_campo $nm_campo;
  474.       $trab_mask  $nm_mask;
  475.       $tam_campo  strlen($nm_campo);
  476.       $trab_saida "";
  477.       $mask_num false;
  478.       for ($x=0$x strlen($trab_mask); $x++)
  479.       {
  480.           if (substr($trab_mask$x1) == "#")
  481.           {
  482.               $mask_num true;
  483.               break;
  484.           }
  485.       }
  486.       if ($mask_num )
  487.       {
  488.           $ver_duas explode(";"$trab_mask);
  489.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  490.           {
  491.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  492.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  493.               if ($cont2 >= $tam_campo)
  494.               {
  495.                   $trab_mask $ver_duas[1];
  496.               }
  497.               else
  498.               {
  499.                   $trab_mask $ver_duas[0];
  500.               }
  501.           }
  502.           $tam_mask strlen($trab_mask);
  503.           $xdados 0;
  504.           for ($x=0$x $tam_mask$x++)
  505.           {
  506.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  507.               {
  508.                   $trab_saida .= substr($trab_campo$xdados1);
  509.                   $xdados++;
  510.               }
  511.               elseif ($xdados $tam_campo)
  512.               {
  513.                   $trab_saida .= substr($trab_mask$x1);
  514.               }
  515.           }
  516.           if ($xdados $tam_campo)
  517.           {
  518.               $trab_saida .= substr($trab_campo$xdados);
  519.           }
  520.           $nm_campo $trab_saida;
  521.           return;
  522.       }
  523.       for ($ix strlen($trab_mask); $ix 0$ix--)
  524.       {
  525.            $char_mask substr($trab_mask$ix 11);
  526.            if ($char_mask != "x" && $char_mask != "z")
  527.            {
  528.                $trab_saida $char_mask $trab_saida;
  529.            }
  530.            else
  531.            {
  532.                if ($tam_campo != 0)
  533.                {
  534.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  535.                    $tam_campo--;
  536.                }
  537.                else
  538.                {
  539.                    $trab_saida "0" $trab_saida;
  540.                }
  541.            }
  542.       }
  543.       if ($tam_campo != 0)
  544.       {
  545.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  546.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  547.       }
  548.    
  549.       $iz 0
  550.       for ($ix 0$ix strlen($trab_mask); $ix++)
  551.       {
  552.            $char_mask substr($trab_mask$ix1);
  553.            if ($char_mask != "x" && $char_mask != "z")
  554.            {
  555.                if ($char_mask == "." || $char_mask == ",")
  556.                {
  557.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  558.                }
  559.                else
  560.                {
  561.                    $iz++;
  562.                }
  563.            }
  564.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  565.            {
  566.                $ix strlen($trab_mask) + 1;
  567.            }
  568.            else
  569.            {
  570.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  571.            }
  572.       }
  573.       $nm_campo $trab_saida;
  574.    } 
  575. }

  576. ?>
Return
grid_new_res_ltr.css
Return
grid_new_res_rtf.class.php
  1. <?php

  2. class grid_new_res_rtf
  3. {
  4.    var $Erro;
  5.    var $Ini;
  6.    var $Res;
  7.    var $Lookup;
  8.    var $nm_data;
  9.    var $Texto_tag;
  10.    var $Arquivo;
  11.    var $Tit_doc;

  12.    //---- 
  13.    function __construct()
  14.    {
  15.       $this->nm_data   = new nm_data("en_us");
  16.       $this->Texto_tag "";
  17.    }

  18.    //---- 
  19.    function monta_rtf()
  20.    {
  21.       $this->inicializa_vars();
  22.       $this->gera_texto_tag();
  23.       $this->grava_arquivo_rtf();
  24.       if ($this->Ini->sc_export_ajax)
  25.       {
  26.           $this->Arr_result['file_export']  = NM_charset_to_utf8($this->Rtf_f);
  27.           $this->Arr_result['title_export'] = NM_charset_to_utf8($this->Tit_doc);
  28.           $Temp ob_get_clean();
  29.           $oJson = new Services_JSON();
  30.           echo $oJson->encode($this->Arr_result);
  31.           exit;
  32.       }
  33.       else
  34.       {
  35.           $this->progress_bar_end();
  36.       }
  37.    }

  38.    //----- 
  39.    function inicializa_vars()
  40.    {
  41.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  42.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  43.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  44.       require_once($this->Ini->path_aplicacao $this->Ini->Apl_resumo); 
  45.       $this->array_titulos = array();
  46.       $this->array_linhas  = array();
  47.       $this->Arquivo    "sc_rtf";
  48.       $this->Arquivo   .= "_" date('YmdHis') . "_" rand(01000);
  49.       $this->Arquivo   .= "_grid_new";
  50.       $this->Arquivo   .= ".rtf";
  51.       $this->Tit_doc    "grid_new.rtf";
  52.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_name']))
  53.       {
  54.           $this->Arquivo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_name'];
  55.           $this->Tit_doc $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_name'];
  56.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_name']);
  57.       }
  58.       $this->Res        = new grid_new_resumo("out");
  59.       $this->prep_modulos("Res");
  60.       if (!$this->Ini->sc_export_ajax) {
  61.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  62.           $this->pb = new scProgressBar();
  63.           $this->pb->setRoot($this->Ini->root);
  64.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  65.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  66.           $this->pb->initialize();
  67.           $this->pb->setReturnUrl("./");
  68.           $this->pb->setReturnOption('resumo');
  69.           $this->pb->setTotalSteps(100);
  70.           $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  71.           $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  72.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  73.               $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  74.               $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  75.           }
  76.           $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  77.           $this->pb->addSteps(50);
  78.       }
  79.    }


  80.    //---- 
  81.    function prep_modulos($modulo)
  82.    {
  83.       $this->$modulo->Ini    $this->Ini;
  84.       $this->$modulo->Db     $this->Db;
  85.       $this->$modulo->Erro   $this->Erro;
  86.       $this->$modulo->Lookup $this->Lookup;
  87.    }
  88.    //----- 
  89.    function gera_texto_tag()
  90.    {
  91.       $this->Res->resumo_export();
  92.       if (!$this->Ini->sc_export_ajax) {
  93.           $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  94.           $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  95.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  96.               $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  97.               $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  98.           }
  99.           $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  100.           $this->pb->addSteps(30);
  101.       }
  102.       $this->comp_field   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_group_by'];
  103.       $this->comp_y_axys  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_y_axys'];
  104.       $this->comp_tabular $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_tabular'];
  105.       $this->build_labels $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['arr_export']['label'];
  106.       $this->build_data   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['arr_export']['data'];
  107.       $this->Texto_tag .= "<table>\r\n";
  108.        $b_display false;
  109.        foreach ($this->build_labels as $lines)
  110.        {
  111.            $this->Texto_tag .= "<tr>\r\n";
  112.            if (!$b_display)
  113.            {
  114.                if ($this->comp_tabular)
  115.                {
  116.                    foreach ($this->comp_y_axys as $iYAxysIndex)
  117.                    {
  118.                        $text_rtf $this->comp_field[$iYAxysIndex];
  119.                        if (!NM_is_utf8($text_rtf))
  120.                        {
  121.                            $text_rtf sc_convert_encoding($text_rtf"UTF-8"$_SESSION['scriptcase']['charset']);
  122.                        }
  123.                        $this->Texto_tag .= "<td rowspan=\"" sizeof($this->build_labels) . "\">" $text_rtf "</td>\r\n";
  124.                    }
  125.                }
  126.                else
  127.                {
  128.                    $s_colspan $this->comp_tabular ' colspan="' sizeof($this->comp_y_axys) .'"' '';
  129.                    $text_rtf $this->Ini->Nm_lang['lang_othr_smry_msge'];
  130.                    if (!NM_is_utf8($text_rtf))
  131.                    {
  132.                        $text_rtf sc_convert_encoding($text_rtf"UTF-8"$_SESSION['scriptcase']['charset']);
  133.                    }
  134.                    $this->Texto_tag .= "<td rowspan=\"" sizeof($this->build_labels) . "\"" $s_colspan ">" $text_rtf "</td>\r\n";
  135.                }
  136.                $b_display true;
  137.            }
  138.            foreach ($lines as $columns)
  139.            {
  140.                $colspan = (isset($columns['colspan']) && $columns['colspan']) ? ' colspan="' $columns['colspan'] . '"' '';
  141.                $rowspan = (isset($columns['rowspan']) && $columns['rowspan']) ? ' rowspan="' $columns['rowspan'] . '"' '';
  142.                $text_rtf $columns['label'];
  143.                if (!NM_is_utf8($text_rtf))
  144.                {
  145.                    $text_rtf sc_convert_encoding($text_rtf"UTF-8"$_SESSION['scriptcase']['charset']);
  146.                }
  147.                $this->Texto_tag .= "<td " $colspan $rowspan ">" $text_rtf "</td>\r\n";
  148.            }
  149.            $this->Texto_tag .= "</tr>\r\n";
  150.        }

  151.        foreach ($this->build_data as $lines)
  152.        {
  153.            $this->Texto_tag .= "<tr>\r\n";
  154.            foreach ($lines as $columns)
  155.            {
  156.                if (<= $columns['level'])
  157.                {
  158.                    $s_text    $this->comp_tabular $columns['label'] : str_repeat('   '$columns['level']) . $columns['label'];
  159.                }
  160.                else
  161.                {
  162.                    $s_text    $this->formatValue($columns['params'][sizeof($columns['params']) - 1], $columns['value']);
  163.                }
  164.                if (!NM_is_utf8($s_text))
  165.                {
  166.                    $s_text sc_convert_encoding($s_text"UTF-8"$_SESSION['scriptcase']['charset']);
  167.                }
  168.                $colspan = (isset($columns['colspan']) && $columns['colspan']) ? ' colspan="' $columns['colspan'] . '"' '';
  169.                $rowspan = (isset($columns['rowspan']) && $columns['rowspan']) ? ' rowspan="' $columns['rowspan'] . '"' '';
  170.                $this->Texto_tag .= "<td " $colspan $rowspan ">" $s_text "</td>\r\n";
  171.            }
  172.            $this->Texto_tag .= "</tr>\r\n";
  173.        }

  174.       $this->Texto_tag .= "</table>\r\n";
  175.    }

  176.    function formatValue($group$valor_campo)
  177.    {
  178.        return $valor_campo;
  179.    }

  180.    //----- 
  181.    function grava_arquivo_rtf()
  182.    {
  183.       global $doc_wrap;
  184.       $this->Rtf_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  185.       $rtf_f fopen($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo"w");
  186.       require_once($this->Ini->path_third      "/rtf_new/document_generator/cl_xml2driver.php"); 
  187.       $text_ok  =  "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"
  188.       $text_ok .=  "<DOC config_file=\"" $this->Ini->path_third "/rtf_new/doc_config.inc\" >\r\n"
  189.       $text_ok .=  $this->Texto_tag
  190.       $text_ok .=  "</DOC>\r\n"
  191.       $xml = new nDOCGEN($text_ok,"RTF"); 
  192.       fwrite($rtf_f$xml->get_result_file());
  193.       fclose($rtf_f);
  194.    }

  195.    function progress_bar_end()
  196.    {
  197.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_file']);
  198.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  199.       {
  200.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  201.       }
  202.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  203.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  204.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  205.       $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  206.       if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  207.           $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  208.       }
  209.       $this->pb->setProgressbarMessage($Mens_bar);
  210.       $this->pb->setDownloadLink($this->Ini->path_imag_temp "/" $this->Arquivo);
  211.       $this->pb->setDownloadMd5($path_doc_md5);
  212.       $this->pb->completed();
  213.    }
  214.    //---- 
  215.    function monta_html()
  216.    {
  217.       global $nm_url_saida;
  218.       include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  219.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_file']);
  220.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  221.       {
  222.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  223.       }
  224.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  225.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  226.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  227. ?>
  228. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  229.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  230. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  231. <HEAD>
  232.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: RTF</TITLE>
  233.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  234. <?php
  235. if ($_SESSION['scriptcase']['proc_mobile'])
  236. {
  237. ?>
  238.   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  239. <?php
  240. }
  241. ?>
  242.   <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  243.   <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  244.   <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  245.   <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  246.   <META http-equiv="Pragma" content="no-cache"/>
  247.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  248.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  249.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  250.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  251. </HEAD>
  252. <BODY class="scExportPage">
  253. <?php echo $this->Ini->Ajax_result_set ?>
  254. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  255.  <table class="scExportTable" align="center">
  256.   <tr>
  257.    <td class="scExportTitle" style="height: 25px">RTF</td>
  258.   </tr>
  259.   <tr>
  260.    <td class="scExportLine" style="width: 100%">
  261.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  262.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  263.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  264.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  265.  ?>
  266.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  267.  ?>
  268.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  269.  ?>
  270.     </td></tr></table>
  271.    </td>
  272.   </tr>
  273.  </table>
  274. </td></tr></table>
  275. <form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp "/" $this->Arquivo ?>" target="_blank" style="display: none"> 
  276. </form>
  277. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  278. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  279. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  280. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  281. </form>
  282. <FORM name="F0" method=post action="./"> 
  283. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  284. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  285. <INPUT type="hidden" name="nmgp_opcao" value="resumo"> 
  286. </FORM> 
  287. </td></tr></table>
  288. </BODY>
  289. </HTML>
  290. <?php
  291.    }
  292.    function nm_gera_mask(&$nm_campo$nm_mask)
  293.    { 
  294.       $trab_campo $nm_campo;
  295.       $trab_mask  $nm_mask;
  296.       $tam_campo  strlen($nm_campo);
  297.       $trab_saida "";
  298.       $mask_num false;
  299.       for ($x=0$x strlen($trab_mask); $x++)
  300.       {
  301.           if (substr($trab_mask$x1) == "#")
  302.           {
  303.               $mask_num true;
  304.               break;
  305.           }
  306.       }
  307.       if ($mask_num )
  308.       {
  309.           $ver_duas explode(";"$trab_mask);
  310.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  311.           {
  312.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  313.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  314.               if ($cont2 >= $tam_campo)
  315.               {
  316.                   $trab_mask $ver_duas[1];
  317.               }
  318.               else
  319.               {
  320.                   $trab_mask $ver_duas[0];
  321.               }
  322.           }
  323.           $tam_mask strlen($trab_mask);
  324.           $xdados 0;
  325.           for ($x=0$x $tam_mask$x++)
  326.           {
  327.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  328.               {
  329.                   $trab_saida .= substr($trab_campo$xdados1);
  330.                   $xdados++;
  331.               }
  332.               elseif ($xdados $tam_campo)
  333.               {
  334.                   $trab_saida .= substr($trab_mask$x1);
  335.               }
  336.           }
  337.           if ($xdados $tam_campo)
  338.           {
  339.               $trab_saida .= substr($trab_campo$xdados);
  340.           }
  341.           $nm_campo $trab_saida;
  342.           return;
  343.       }
  344.       for ($ix strlen($trab_mask); $ix 0$ix--)
  345.       {
  346.            $char_mask substr($trab_mask$ix 11);
  347.            if ($char_mask != "x" && $char_mask != "z")
  348.            {
  349.                $trab_saida $char_mask $trab_saida;
  350.            }
  351.            else
  352.            {
  353.                if ($tam_campo != 0)
  354.                {
  355.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  356.                    $tam_campo--;
  357.                }
  358.                else
  359.                {
  360.                    $trab_saida "0" $trab_saida;
  361.                }
  362.            }
  363.       }
  364.       if ($tam_campo != 0)
  365.       {
  366.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  367.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  368.       }
  369.    
  370.       $iz 0
  371.       for ($ix 0$ix strlen($trab_mask); $ix++)
  372.       {
  373.            $char_mask substr($trab_mask$ix1);
  374.            if ($char_mask != "x" && $char_mask != "z")
  375.            {
  376.                if ($char_mask == "." || $char_mask == ",")
  377.                {
  378.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  379.                }
  380.                else
  381.                {
  382.                    $iz++;
  383.                }
  384.            }
  385.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  386.            {
  387.                $ix strlen($trab_mask) + 1;
  388.            }
  389.            else
  390.            {
  391.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  392.            }
  393.       }
  394.       $nm_campo $trab_saida;
  395.    } 
  396. }

  397. ?>
Return
grid_new_res_rtl.css
Return
grid_new_res_xls.class.php
  1. <?php

  2. class grid_new_res_xls
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;
  8.    var $nm_data;
  9.    var $Xls_dados;
  10.    var $Xls_workbook;
  11.    var $Xls_col;
  12.    var $Xls_row;
  13.    var $array_titulos;
  14.    var $array_linhas;
  15.    var $Arquivo;
  16.    var $Tit_doc;

  17.    //---- 
  18.    function __construct()
  19.    {
  20.    }

  21.    //---- 
  22.    function monta_xls()
  23.    {
  24.       $this->inicializa_vars();
  25.       $this->grava_arquivo();
  26.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_grid']))
  27.       {
  28.           return;
  29.       }
  30.       if ($this->Ini->sc_export_ajax)
  31.       {
  32.           $this->Arr_result['file_export']  = NM_charset_to_utf8($this->Xls_f);
  33.           $this->Arr_result['title_export'] = NM_charset_to_utf8($this->Tit_doc);
  34.           $Temp ob_get_clean();
  35.           $oJson = new Services_JSON();
  36.           echo $oJson->encode($this->Arr_result);
  37.           exit;
  38.       }
  39.       else
  40.       {
  41.           $this->progress_bar_end();
  42.       }
  43.    }

  44.    //----- 
  45.    function inicializa_vars()
  46.    {
  47.       $this->Use_phpspreadsheet false;
  48.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  49.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  50.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  51.       require_once($this->Ini->path_aplicacao $this->Ini->Apl_resumo); 
  52.       $this->Xls_row 1;
  53.       if ($this->Use_phpspreadsheet) {
  54.           require_once $this->Ini->path_third '/phpspreadsheet/vendor/autoload.php';
  55.       } 
  56.       else { 
  57.           set_include_path(get_include_path() . PATH_SEPARATOR $this->Ini->path_third '/phpexcel/');
  58.           require_once $this->Ini->path_third '/phpexcel/PHPExcel.php';
  59.           require_once $this->Ini->path_third '/phpexcel/PHPExcel/IOFactory.php';
  60.       } 
  61.       $this->array_titulos = array();
  62.       $this->array_linhas  = array();
  63.       $this->Xls_password "";
  64.       $this->Xls_tp     ".xlsx";
  65.       $this->Xls_col    0;
  66.       $this->nm_data    = new nm_data("en_us");
  67.       $this->Arquivo    "sc_xls";
  68.       $this->Arquivo   .= "_" date('YmdHis') . "_" rand(01000);
  69.       $this->Arq_zip    $this->Arquivo "_grid_new.zip";
  70.       $this->Arquivo   .= "_grid_new";
  71.       $this->Arquivo   .= $this->Xls_tp;
  72.       $this->Tit_doc    "grid_new" $this->Xls_tp;
  73.       $this->Tit_zip    "grid_new.zip";
  74.       if (isset($_POST['nmgp_tp_xls']) && !empty($_POST['nmgp_tp_xls']))
  75.       {
  76.           $this->Xls_tp "." $_POST['nmgp_tp_xls'];
  77.       }
  78.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name']))
  79.       {
  80.           $this->Arquivo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'];
  81.           $this->Arq_zip $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'];
  82.           $this->Tit_doc $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'];
  83.           $Pos strrpos($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'], ".");
  84.           if ($Pos !== false) {
  85.               $this->Arq_zip substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'], 0$Pos);
  86.           }
  87.           $this->Arq_zip .= ".zip";
  88.           $this->Tit_zip  $this->Arq_zip;
  89.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name']);
  90.       }
  91.       $this->Xls_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  92.       $this->Zip_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arq_zip;
  93.       if ($this->Use_phpspreadsheet) {
  94.           $this->Xls_dados = new PhpOffice\PhpSpreadsheet\Spreadsheet();
  95.       }
  96.       else {
  97.           $this->Xls_dados = new PHPExcel();
  98.       }
  99.       $this->Xls_dados->setActiveSheetIndex(0);
  100.       $this->Nm_ActiveSheet $this->Xls_dados->getActiveSheet();
  101.       $this->Nm_ActiveSheet->setTitle($this->Ini->Nm_lang['lang_othr_smry_titl']);
  102.       if ($_SESSION['scriptcase']['reg_conf']['css_dir'] == "RTL")
  103.       {
  104.           $this->Nm_ActiveSheet->setRightToLeft(true);
  105.       }
  106.       $this->Res       = new grid_new_resumo("out");
  107.       $this->prep_modulos("Res");
  108.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_grid']) && !$this->Ini->sc_export_ajax) {
  109.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  110.           $this->pb = new scProgressBar();
  111.           $this->pb->setRoot($this->Ini->root);
  112.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  113.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  114.           $this->pb->initialize();
  115.           $this->pb->setReturnUrl("./");
  116.           $this->pb->setReturnOption($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_return']);
  117.           $this->pb->setTotalSteps(100);
  118.           $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  119.           $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  120.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  121.               $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  122.               $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  123.           }
  124.           $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  125.           $this->pb->addSteps(50);
  126.       }
  127.    }

  128.    //---- 
  129.    function prep_modulos($modulo)
  130.    {
  131.       $this->$modulo->Ini    $this->Ini;
  132.       $this->$modulo->Db     $this->Db;
  133.       $this->$modulo->Erro   $this->Erro;
  134.       $this->$modulo->Lookup $this->Lookup;
  135.    }

  136.    //----- 
  137.    function grava_arquivo()
  138.    {
  139.       $this->Res->resumo_export();
  140.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_grid']) && !$this->Ini->sc_export_ajax) {
  141.           $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  142.           $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  143.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  144.               $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  145.               $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  146.           }
  147.           $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  148.           $this->pb->addSteps(30);
  149.       }
  150.       $this->comp_field   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_group_by'];
  151.       $this->comp_y_axys  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_y_axys'];
  152.       $this->comp_tabular $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_tabular'];
  153.       $this->array_titulos $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['arr_export']['label'];
  154.       $this->array_linhas  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['arr_export']['data'];
  155.       $b_display false;
  156.       $contr_rowspan = array();
  157.       $contr_colspan = array();
  158.       foreach ($this->array_titulos as $lines)
  159.       {
  160.            $this->Xls_col 0;
  161.            if (!$b_display)
  162.            {
  163.                if ($this->comp_tabular)
  164.                {
  165.                    foreach ($this->comp_y_axys as $iYAxysIndex)
  166.                    {
  167.                        $contr_rowspan[$this->Xls_col] = sizeof($this->array_titulos);
  168.                        $contr_colspan[$this->Xls_col] = 1;
  169.                        if ($this->Use_phpspreadsheet) {
  170.                            $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  171.                        }
  172.                        else {
  173.                            $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  174.                        }
  175.                        $this->Nm_ActiveSheet->setCellValue($this->calc_cell($this->Xls_col) . $this->Xls_row$this->comp_field[$iYAxysIndex]);
  176.                        $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getFont()->setBold(true);
  177.                        $this->Nm_ActiveSheet->getColumnDimension($this->calc_cell($this->Xls_col))->setAutoSize(true);
  178.                        $this->Xls_col += 1;
  179.                    }
  180.                }
  181.                else
  182.                {
  183.                    $colspan $this->comp_tabular sizeof($this->comp_y_axys) : 1;
  184.                    $contr_rowspan[$this->Xls_col] = sizeof($this->array_titulos);
  185.                    $contr_colspan[$this->Xls_col] = $colspan;
  186.                    $campo_titulo $this->Ini->Nm_lang['lang_othr_smry_msge'];
  187.                    if (!NM_is_utf8($campo_titulo))
  188.                    {
  189.                        $campo_titulo sc_convert_encoding($campo_titulo"UTF-8"$_SESSION['scriptcase']['charset']);
  190.                    }
  191.                    if ($this->Use_phpspreadsheet) {
  192.                        $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  193.                    }
  194.                    else {
  195.                        $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  196.                    }
  197.                    $this->Nm_ActiveSheet->setCellValue($this->calc_cell($this->Xls_col) . $this->Xls_row$campo_titulo);
  198.                    $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getFont()->setBold(true);
  199.                    $this->Nm_ActiveSheet->getColumnDimension($this->calc_cell($this->Xls_col))->setAutoSize(true);
  200.                    $this->Xls_col += $colspan;
  201.                }
  202.                $b_display true;
  203.            }
  204.            foreach ($lines as $columns)
  205.            {
  206.                $col_ok false;
  207.                $colspan = (isset($columns['colspan']) && $columns['colspan']) ? $columns['colspan'] : 1;
  208.                while (!$col_ok)
  209.                {
  210.                    if (isset($contr_rowspan[$this->Xls_col]) && $contr_rowspan[$this->Xls_col])
  211.                    {
  212.                        $contr_rowspan[$this->Xls_col]--;
  213.                        $this->Xls_col += $contr_colspan[$this->Xls_col];
  214.                    }
  215.                    else
  216.                    {
  217.                        $col_ok true;
  218.                    }
  219.                }
  220.                if (isset($columns['rowspan']) && $columns['rowspan'])
  221.                {
  222.                    $contr_rowspan[$this->Xls_col] = $columns['rowspan'];
  223.                    $contr_colspan[$this->Xls_col] = $colspan;
  224.                }
  225.                $campo_titulo $columns['label'];
  226.                if (!NM_is_utf8($campo_titulo))
  227.                {
  228.                    $campo_titulo sc_convert_encoding($campo_titulo"UTF-8"$_SESSION['scriptcase']['charset']);
  229.                }
  230.                if ($this->Use_phpspreadsheet) {
  231.                    $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
  232.                }
  233.                else {
  234.                    $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  235.                }
  236.                $this->Nm_ActiveSheet->setCellValue($this->calc_cell($this->Xls_col) . $this->Xls_row$campo_titulo);
  237.                $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getFont()->setBold(true);
  238.                $this->Nm_ActiveSheet->getColumnDimension($this->calc_cell($this->Xls_col))->setAutoSize(true);
  239.                $this->Xls_col += $colspan;
  240.            }
  241.            foreach ($contr_rowspan as $col => $row)
  242.            {
  243.                if ($col >= $this->Xls_col && $row 1)
  244.                {
  245.                    $contr_rowspan[$col]--;
  246.                }
  247.            }
  248.            $this->Xls_row++;
  249.       }
  250.       foreach ($this->array_linhas as $lines)
  251.       {
  252.            $this->Xls_col 0;
  253.            $colspan       0;
  254.            foreach ($lines as $num_col => $columns)
  255.            {
  256.                if (<= $columns['level'])
  257.                {
  258.                    $cada_dado $this->comp_tabular $columns['label'] : str_repeat('   '$columns['level']) . $columns['label'];
  259.                }
  260.                else
  261.                {
  262.                    $cada_dado $columns['value'];
  263.                }
  264.                if (!NM_is_utf8($cada_dado))
  265.                {
  266.                    $cada_dado sc_convert_encoding($cada_dado"UTF-8"$_SESSION['scriptcase']['charset']);
  267.                }
  268.                $this->Xls_col $num_col $colspan;
  269.                if (isset($columns['colspan']) && $columns['colspan'] > 0)
  270.                {
  271.                    $colspan = ($columns['colspan'] - 1);
  272.                }
  273.                if (<= $columns['level'])
  274.                {
  275.                    if (!NM_is_utf8($cada_dado))
  276.                    {
  277.                        $cada_dado sc_convert_encoding($cada_dado"UTF-8"$_SESSION['scriptcase']['charset']);
  278.                    }
  279.                    if ($this->Use_phpspreadsheet) {
  280.                        $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  281.                    }
  282.                    else {
  283.                        $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  284.                    }
  285.                    $this->Nm_ActiveSheet->setCellValue($this->calc_cell($this->Xls_col) . $this->Xls_row$cada_dado);
  286.                }
  287.                else
  288.                {
  289.                    if (!NM_is_utf8($cada_val))
  290.                    {
  291.                        $cada_val sc_convert_encoding($cada_val"UTF-8"$_SESSION['scriptcase']['charset']);
  292.                    }
  293.                    if ($this->Use_phpspreadsheet) {
  294.                        $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
  295.                    }
  296.                    else {
  297.                        $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  298.                    }
  299.                    $this->Nm_ActiveSheet->getStyle($this->calc_cell($this->Xls_col) . $this->Xls_row)->getNumberFormat()->setFormatCode('#,##0');
  300.                    $this->Nm_ActiveSheet->setCellValue($this->calc_cell($this->Xls_col) . $this->Xls_row$cada_dado);
  301.                }
  302.                $this->Xls_col += $colspan;
  303.            }
  304.            $this->Xls_row++;
  305.       }
  306.       if ($this->Use_phpspreadsheet) {
  307.           if ($this->Xls_tp == ".xlsx") {
  308.               $objWriter = new PhpOffice\PhpSpreadsheet\Writer\Xlsx($this->Xls_dados);
  309.           } 
  310.           else {
  311.               $objWriter = new PhpOffice\PhpSpreadsheet\Writer\Xls($this->Xls_dados);
  312.           } 
  313.       } 
  314.       else {
  315.           if ($this->Xls_tp == ".xlsx") {
  316.               $objWriter = new PHPExcel_Writer_Excel2007($this->Xls_dados);
  317.           } 
  318.           else {
  319.               $objWriter = new PHPExcel_Writer_Excel5($this->Xls_dados);
  320.           } 
  321.       } 
  322.       $objWriter->save($this->Xls_f);
  323.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_grid']))
  324.       {
  325.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_sheet'] = $this->Xls_f;
  326.       }
  327.       elseif ($this->Xls_password != "")
  328.       { 
  329.           $str_zip "";
  330.           $Zip_f = (FALSE !== strpos($this->Zip_f' ')) ? " \"" $this->Zip_f "\"" :  $this->Zip_f;
  331.           $Arq_input  = (FALSE !== strpos($this->Xls_f' ')) ? " \"" $this->Xls_f "\"" :  $this->Xls_f;
  332.           if (is_file($Zip_f)) {
  333.               unlink($Zip_f);
  334.           }
  335.           if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  336.           {
  337.               chdir($this->Ini->path_third "/zip/windows");
  338.               $str_zip "zip.exe -P -j " $this->Xls_password " " $Zip_f " " $Arq_input;
  339.           }
  340.           elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  341.           {
  342.                 if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  343.                 {
  344.                     chdir($this->Ini->path_third "/zip/linux-i386/bin");
  345.                 }
  346.                 else
  347.                 {
  348.                     chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  349.                 }
  350.               $str_zip "./7za -p" $this->Xls_password " a " $Zip_f " " $Arq_input;
  351.           }
  352.           elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  353.           {
  354.               chdir($this->Ini->path_third "/zip/mac/bin");
  355.               $str_zip "./7za -p" $this->Xls_password " a " $Zip_f " " $Arq_input;
  356.           }
  357.           if (!empty($str_zip)) {
  358.               exec($str_zip);
  359.           }
  360.           unlink($Arq_input);
  361.           $this->Arquivo $this->Arq_zip;
  362.           $this->Xls_f   $this->Zip_f;
  363.           $this->Tit_doc $this->Tit_zip;
  364.           // ----- ZIP log
  365.           $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'w');
  366.           if ($fp)
  367.           {
  368.               @fwrite($fp$str_zip "\r\n\r\n");
  369.               @fclose($fp);
  370.           }
  371.       } 
  372.    }


  373.    function calc_cell($col)
  374.    {
  375.        $arr_alfa = array("","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
  376.        $val_ret "";
  377.        $result $col 1;
  378.        while ($result 26)
  379.        {
  380.            $cel      $result 26;
  381.            $result   $result 26;
  382.            if ($cel == 0)
  383.            {
  384.                $cel    26;
  385.                $result--;
  386.            }
  387.            $val_ret $arr_alfa[$cel] . $val_ret;
  388.        }
  389.        $val_ret $arr_alfa[$result] . $val_ret;
  390.        return $val_ret;
  391.    }
  392.    function progress_bar_end()
  393.    {
  394.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_file']);
  395.       if (is_file($this->Xls_f))
  396.       {
  397.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_file'] = $this->Xls_f;
  398.       }
  399.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  400.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  401.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  402.       $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  403.       if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  404.           $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  405.       }
  406.       $this->pb->setProgressbarMessage($Mens_bar);
  407.       $this->pb->setDownloadLink($this->Ini->path_imag_temp "/" $this->Arquivo);
  408.       $this->pb->setDownloadMd5($path_doc_md5);
  409.       $this->pb->completed();
  410.    }
  411.    //---- 
  412.    function monta_html()
  413.    {
  414.       global $nm_url_saida;
  415.       include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  416.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_file']);
  417.       if (is_file($this->Xls_f))
  418.       {
  419.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_file'] = $this->Xls_f;
  420.       }
  421.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  422.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  423.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  424. ?>
  425. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  426.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  427. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  428. <HEAD>
  429.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: Excel</TITLE>
  430.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  431. <?php
  432. if ($_SESSION['scriptcase']['proc_mobile'])
  433. {
  434. ?>
  435.   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  436. <?php
  437. }
  438. ?>
  439.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  440.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  441.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  442.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  443.  <META http-equiv="Pragma" content="no-cache"/>
  444.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  445.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  446.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  447.  <?php
  448.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  449.  {
  450.  ?>
  451.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  452.  <?php
  453.  }
  454.  ?>
  455.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  456. </HEAD>
  457. <BODY class="scExportPage">
  458. <?php echo $this->Ini->Ajax_result_set ?>
  459. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  460.  <table class="scExportTable" align="center">
  461.   <tr>
  462.    <td class="scExportTitle" style="height: 25px">XLS</td>
  463.   </tr>
  464.   <tr>
  465.    <td class="scExportLine" style="width: 100%">
  466.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  467.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  468.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  469.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  470.  ?>
  471.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  472.  ?>
  473.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  474.  ?>
  475.     </td></tr></table>
  476.    </td>
  477.   </tr>
  478.  </table>
  479. </td></tr></table>
  480. <form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp "/" $this->Arquivo ?>" target="_blank" style="display: none"> 
  481. </form>
  482. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  483. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  484. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  485. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  486. </form>
  487. <FORM name="F0" method=post action="./"> 
  488. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  489. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  490. <INPUT type="hidden" name="nmgp_opcao" value="<?php echo NM_encode_input($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_return']); ?>"> 
  491. </FORM> 
  492. </td></tr></table>
  493. </BODY>
  494. </HTML>
  495. <?php
  496.    }
  497.    function nm_gera_mask(&$nm_campo$nm_mask)
  498.    { 
  499.       $trab_campo $nm_campo;
  500.       $trab_mask  $nm_mask;
  501.       $tam_campo  strlen($nm_campo);
  502.       $trab_saida "";
  503.       $mask_num false;
  504.       for ($x=0$x strlen($trab_mask); $x++)
  505.       {
  506.           if (substr($trab_mask$x1) == "#")
  507.           {
  508.               $mask_num true;
  509.               break;
  510.           }
  511.       }
  512.       if ($mask_num )
  513.       {
  514.           $ver_duas explode(";"$trab_mask);
  515.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  516.           {
  517.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  518.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  519.               if ($cont2 >= $tam_campo)
  520.               {
  521.                   $trab_mask $ver_duas[1];
  522.               }
  523.               else
  524.               {
  525.                   $trab_mask $ver_duas[0];
  526.               }
  527.           }
  528.           $tam_mask strlen($trab_mask);
  529.           $xdados 0;
  530.           for ($x=0$x $tam_mask$x++)
  531.           {
  532.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  533.               {
  534.                   $trab_saida .= substr($trab_campo$xdados1);
  535.                   $xdados++;
  536.               }
  537.               elseif ($xdados $tam_campo)
  538.               {
  539.                   $trab_saida .= substr($trab_mask$x1);
  540.               }
  541.           }
  542.           if ($xdados $tam_campo)
  543.           {
  544.               $trab_saida .= substr($trab_campo$xdados);
  545.           }
  546.           $nm_campo $trab_saida;
  547.           return;
  548.       }
  549.       for ($ix strlen($trab_mask); $ix 0$ix--)
  550.       {
  551.            $char_mask substr($trab_mask$ix 11);
  552.            if ($char_mask != "x" && $char_mask != "z")
  553.            {
  554.                $trab_saida $char_mask $trab_saida;
  555.            }
  556.            else
  557.            {
  558.                if ($tam_campo != 0)
  559.                {
  560.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  561.                    $tam_campo--;
  562.                }
  563.                else
  564.                {
  565.                    $trab_saida "0" $trab_saida;
  566.                }
  567.            }
  568.       }
  569.       if ($tam_campo != 0)
  570.       {
  571.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  572.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  573.       }
  574.    
  575.       $iz 0
  576.       for ($ix 0$ix strlen($trab_mask); $ix++)
  577.       {
  578.            $char_mask substr($trab_mask$ix1);
  579.            if ($char_mask != "x" && $char_mask != "z")
  580.            {
  581.                if ($char_mask == "." || $char_mask == ",")
  582.                {
  583.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  584.                }
  585.                else
  586.                {
  587.                    $iz++;
  588.                }
  589.            }
  590.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  591.            {
  592.                $ix strlen($trab_mask) + 1;
  593.            }
  594.            else
  595.            {
  596.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  597.            }
  598.       }
  599.       $nm_campo $trab_saida;
  600.    } 
  601. }

  602. ?>
Return
grid_new_res_xml.class.php
  1. <?php

  2. class grid_new_res_xml
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;
  8.    var $nm_data;
  9.    var $array_titulos;
  10.    var $array_linhas;
  11.    var $campo_titulo;

  12.    var $Arquivo;
  13.    var $Arquivo_view;
  14.    var $Tit_doc;
  15.    var $sc_proc_grid

  16.    //---- 
  17.    function __construct()
  18.    {
  19.       $this->nm_data   = new nm_data("en_us");
  20.    }

  21.    //---- 
  22.    function monta_xml()
  23.    {
  24.       $this->inicializa_vars();
  25.       $this->grava_arquivo();
  26.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_grid']))
  27.       {
  28.           return;
  29.       }
  30.       if ($this->Ini->sc_export_ajax)
  31.       {
  32.           $this->Arr_result['file_export']  = NM_charset_to_utf8($this->Xml_f);
  33.           $this->Arr_result['title_export'] = NM_charset_to_utf8($this->Tit_doc);
  34.           $Temp ob_get_clean();
  35.           $oJson = new Services_JSON();
  36.           echo $oJson->encode($this->Arr_result);
  37.           exit;
  38.       }
  39.       else
  40.       {
  41.           $this->progress_bar_end();
  42.       }
  43.    }

  44.    //----- 
  45.    function inicializa_vars()
  46.    {
  47.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  48.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  49.       $this->New_Format  true;
  50.       $this->Xml_password  "";
  51.       if (isset($_POST['nm_xml_tag']) && !empty($_POST['nm_xml_tag']))
  52.       {
  53.           $this->New_Format = ($_POST['nm_xml_tag'] == "tag") ? true false;
  54.       }
  55.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  56.       require_once($this->Ini->path_aplicacao $this->Ini->Apl_resumo); 
  57.       $this->array_titulos = array();
  58.       $this->array_linhas  = array();
  59.       $this->campo_titulo  = array();
  60.       $this->nm_data       = new nm_data("en_us");
  61.       $this->Arquivo       "sc_xml";
  62.       $this->Arquivo      .= "_" date('YmdHis') . "_" rand(01000);
  63.       $this->Arq_zip       $this->Arquivo "_grid_new.zip";
  64.       $this->Arquivo      .= "_grid_new";
  65.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_grid']))
  66.       {
  67.           $this->Arquivo      .= "_" $this->Ini->Nm_lang['lang_othr_smry_titl'];
  68.       }
  69.       $this->Arquivo_view  $this->Arquivo "_view.xml";
  70.       $this->Arquivo      .= ".xml";
  71.       $this->Tit_doc       "grid_new.xml";
  72.       $this->Tit_zip       "grid_new.zip";
  73.       $this->Grava_view   false;
  74.       if (strtolower($_SESSION['scriptcase']['charset']) != strtolower($_SESSION['scriptcase']['charset_html']))
  75.       {
  76.           $this->Grava_view true;
  77.       }
  78.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name']))
  79.       {
  80.           $this->Arquivo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'];
  81.           $this->Arq_zip $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'];
  82.           $this->Tit_doc $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'];
  83.           $Pos strrpos($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'], ".");
  84.           if ($Pos !== false) {
  85.               $this->Arq_zip substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'], 0$Pos);
  86.           }
  87.           $this->Arq_zip .= ".zip";
  88.           $this->Tit_zip  $this->Arq_zip;
  89.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name']);
  90.       }
  91.       if (!$this->Grava_view)
  92.       {
  93.           $this->Arquivo_view $this->Arquivo;
  94.       }
  95.       $this->Res       = new grid_new_resumo("out");
  96.       $this->prep_modulos("Res");
  97.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_grid']) && !$this->Ini->sc_export_ajax) {
  98.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  99.           $this->pb = new scProgressBar();
  100.           $this->pb->setRoot($this->Ini->root);
  101.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  102.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  103.           $this->pb->initialize();
  104.           $this->pb->setReturnUrl("./");
  105.           $this->pb->setReturnOption($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_return']);
  106.           $this->pb->setTotalSteps(100);
  107.           $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  108.           $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  109.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  110.               $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  111.               $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  112.           }
  113.           $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  114.           $this->pb->addSteps(50);
  115.       }
  116.    }

  117.    //---- 
  118.    function prep_modulos($modulo)
  119.    {
  120.       $this->$modulo->Ini    $this->Ini;
  121.       $this->$modulo->Db     $this->Db;
  122.       $this->$modulo->Erro   $this->Erro;
  123.       $this->$modulo->Lookup $this->Lookup;
  124.    }

  125.    //----- 
  126.    function grava_arquivo()
  127.    {
  128.       $xml_charset $_SESSION['scriptcase']['charset'];
  129.       $this->Xml_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  130.       $this->Zip_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arq_zip;
  131.       $xml_f       fopen($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo"w");
  132.       fwrite($xml_f"<?xml version=\"1.0\" encoding=\"$xml_charset\" ?>\r\n");
  133.       fwrite($xml_f"<root>\r\n");
  134.       if ($this->New_Format)
  135.       {
  136.           fwrite($xml_f"<grid_new>\r\n");
  137.       }
  138.       if ($this->Grava_view)
  139.       {
  140.           $xml_charset_v $_SESSION['scriptcase']['charset_html'];
  141.           $xml_v         fopen($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo_view"w");
  142.           fwrite($xml_v"<?xml version=\"1.0\" encoding=\"$xml_charset_v\" ?>\r\n");
  143.           fwrite($xml_v"<root>\r\n");
  144.           if ($this->New_Format)
  145.           {
  146.               fwrite($xml_v"<grid_new>\r\n");
  147.           }
  148.       }
  149.       $this->Res->resumo_export();
  150.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_grid']) && !$this->Ini->sc_export_ajax) {
  151.           $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  152.           $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  153.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  154.               $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  155.               $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  156.           }
  157.           $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  158.           $this->pb->addSteps(30);
  159.       }
  160.       $this->array_titulos $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['arr_export']['label'];
  161.       $this->array_linhas  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['arr_export']['data'];
  162.       $contr_rowspan = array();
  163.       $tit_rowspan   = array();
  164.       foreach ($this->array_titulos as $lines)
  165.       {
  166.            $col 0;
  167.            foreach ($lines as $columns)
  168.            {
  169.                $col_ok false;
  170.                $colspan = (isset($columns['colspan']) && $columns['colspan']) ? $columns['colspan'] : 1;
  171.                while (!$col_ok)
  172.                {
  173.                    if (isset($contr_rowspan[$col]) && $contr_rowspan[$col])
  174.                    {
  175.                        if (isset($this->campo_titulo[$col]))   
  176.                        {
  177.                           $this->campo_titulo[$col] .= "_";
  178.                        }
  179.                        $this->campo_titulo[$col] .= $tit_rowspan[$col];
  180.                        $contr_rowspan[$col]--;
  181.                        $col++;
  182.                    }
  183.                    else
  184.                    {
  185.                        $col_ok true;
  186.                    }
  187.                }
  188.                $col_t $col;
  189.                if (isset($columns['rowspan']) && $columns['rowspan'])
  190.                {
  191.                    $contr_rowspan[$col] = $columns['rowspan'];
  192.                    for ($x 0$x $colspan$x++)
  193.                    {
  194.                         if (isset($tit_rowspan[$col_t]))   
  195.                         {
  196.                             $tit_rowspan[$col_t] .= "_";
  197.                         }
  198.                         $tit_rowspan[$col_t] .= $columns['label'];
  199.                        $col_t++;
  200.                    }
  201.                }
  202.                for ($x 0$x $colspan$x++)
  203.                {
  204.                     if (isset($this->campo_titulo[$col]))   
  205.                     {
  206.                        $this->campo_titulo[$col] .= "_";
  207.                     }
  208.                     $this->campo_titulo[$col] .= $columns['label'];
  209.                    $col++;
  210.                }
  211.            }
  212.            foreach ($contr_rowspan as $col_t => $row)
  213.            {
  214.                if ($col_t >= $col && $row 1)
  215.                {
  216.                    $contr_rowspan[$col]--;
  217.                }
  218.            }
  219.       }
  220.       foreach ($this->campo_titulo as $col => $titulo)
  221.       {
  222.           if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->campo_titulo[$col]))
  223.           {
  224.               $this->campo_titulo[$col] = sc_convert_encoding($this->campo_titulo[$col], "UTF-8"$_SESSION['scriptcase']['charset']);
  225.           }
  226.       }
  227.       $this->grava_linha($xml_f);
  228.       if ($this->New_Format)
  229.       {
  230.           fwrite($xml_f"</grid_new>\r\n");
  231.       }
  232.       fwrite($xml_f"</root>");
  233.       fclose($xml_f);
  234.       if ($this->Grava_view)
  235.       {
  236.           $this->grava_linha($xml_v);
  237.           if ($this->New_Format)
  238.           {
  239.               fwrite($xml_v"</grid_new>\r\n");
  240.           }
  241.           fwrite($xml_v"</root>");
  242.           fclose($xml_v);
  243.       }
  244.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_grid']))
  245.       {
  246.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_file']['xml'] = $this->Xml_f;
  247.           if ($this->Grava_view)
  248.           {
  249.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_file']['view'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo_view;
  250.           }
  251.       }
  252.       elseif ($this->Xml_password != "")
  253.       { 
  254.           $str_zip "";
  255.           $Zip_f = (FALSE !== strpos($this->Zip_f' ')) ? " \"" $this->Zip_f "\"" :  $this->Zip_f;
  256.           $Arq_input  = (FALSE !== strpos($this->Xml_f' ')) ? " \"" $this->Xml_f "\"" :  $this->Xml_f;
  257.           if (is_file($Zip_f)) {
  258.               unlink($Zip_f);
  259.           }
  260.           if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  261.           {
  262.               chdir($this->Ini->path_third "/zip/windows");
  263.               $str_zip "zip.exe -P -j " $this->Xml_password " " $Zip_f " " $Arq_input;
  264.           }
  265.           elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  266.           {
  267.                 if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  268.                 {
  269.                     chdir($this->Ini->path_third "/zip/linux-i386/bin");
  270.                 }
  271.                 else
  272.                 {
  273.                     chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  274.                 }
  275.               $str_zip "./7za -p" $this->Xml_password " a " $Zip_f " " $Arq_input;
  276.           }
  277.           elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  278.           {
  279.               chdir($this->Ini->path_third "/zip/mac/bin");
  280.               $str_zip "./7za -p" $this->Xml_password " a " $Zip_f " " $Arq_input;
  281.           }
  282.           if (!empty($str_zip)) {
  283.               exec($str_zip);
  284.           }
  285.           // ----- ZIP log
  286.           $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'w');
  287.           if ($fp)
  288.           {
  289.               @fwrite($fp$str_zip "\r\n\r\n");
  290.               @fclose($fp);
  291.           }
  292.           unlink($Arq_input);
  293.           $this->Arquivo $this->Arq_zip;
  294.           $this->Xml_f   $this->Zip_f;
  295.           $this->Tit_doc $this->Tit_zip;
  296.           if ($this->Grava_view)
  297.           {
  298.               $str_zip "";
  299.               $xml_view_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo_view;
  300.               $zip_view_f str_replace(".zip""_view.zip"$this->Zip_f);
  301.               $zip_arq_v  str_replace(".zip""_view.zip"$this->Arq_zip);
  302.               $Zip_f      = (FALSE !== strpos(\zip_view_f' ')) ? " \"" . \zip_view_f "\"" :  \zip_view_f;
  303.               $Arq_input  = (FALSE !== strpos($xml_view_f' ')) ? " \"" $xml_view_f "\"" :  $xml_view_f;
  304.               if (is_file($Zip_f)) {
  305.                   unlink($Zip_f);
  306.               }
  307.               if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  308.               {
  309.                   chdir($this->Ini->path_third "/zip/windows");
  310.                   $str_zip "zip.exe -P -j " $this->Xml_password " " $Zip_f " " $Arq_input;
  311.               }
  312.               elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  313.               {
  314.                  if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  315.                  {
  316.                      chdir($this->Ini->path_third "/zip/linux-i386/bin");
  317.                  }
  318.                  else
  319.                  {
  320.                      chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  321.                  }
  322.                  $str_zip "./7za -p" $this->Xml_password " a " $Zip_f " " $Arq_input;
  323.               }
  324.               elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  325.               {
  326.                   chdir($this->Ini->path_third "/zip/mac/bin");
  327.                  $str_zip "./7za -p" $this->Xml_password " a " $Zip_f " " $Arq_input;
  328.               }
  329.               if (!empty($str_zip)) {
  330.                   exec($str_zip);
  331.               }
  332.               unlink($Arq_input);
  333.               $this->Arquivo_view $zip_arq_v;
  334.               // ----- ZIP log
  335.               $fp = @fopen(str_replace(".zip"".log"$Zip_f), 'a');
  336.               if ($fp)
  337.               {
  338.                   @fwrite($fp$str_zip "\r\n\r\n");
  339.                   @fclose($fp);
  340.               }
  341.           } 
  342.           else 
  343.           {
  344.               $this->Arquivo_view $this->Arq_zip;
  345.           } 
  346.       } 
  347.    }

  348.    //----- 
  349.    function grava_linha($xml_f)
  350.    {
  351.       $contr_rowspan "";
  352.       $tit_rowspan   "";
  353.       foreach ($this->array_linhas as $lines)
  354.       {
  355.           $col           0;
  356.           $lab           "";
  357.           $cmp           false;
  358.           $xml_registro  "";
  359.           if (!$this->New_Format)
  360.           {
  361.               $xml_registro "<grid_new";
  362.           }
  363.           foreach ($lines as $columns)
  364.           {
  365.               if (<= $columns['level'])
  366.               {
  367.                   $cada_dado $columns['label'];
  368.                   $cada_dado str_replace("&nbsp;"""$cada_dado);
  369.                   if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($cada_dado))
  370.                   {
  371.                       $cada_dado sc_convert_encoding($cada_dado"UTF-8"$_SESSION['scriptcase']['charset']);
  372.                   }
  373.                   if (isset($columns['rowspan']) && $columns['rowspan'] > 1)
  374.                   {
  375.                       $contr_rowspan $columns['rowspan'];
  376.                       $tit_rowspan   = (!empty($tit_rowspan)) ? "_" $cada_dado $cada_dado;
  377.                   }
  378.                   else
  379.                   {
  380.                      $lab .= (empty($lab)) ? $cada_dado "_" $cada_dado;
  381.                   }
  382.               }
  383.               else
  384.               {
  385.                   if (!$cmp)
  386.                   {
  387.                       if (!empty($contr_rowspan) && $contr_rowspan 0)
  388.                       {
  389.                           $lab $tit_rowspan "_" $lab;
  390.                           $contr_rowspan--;
  391.                       }
  392.                       $this->clear_tag($lab);
  393.                       if ($this->New_Format)
  394.                       {
  395.                           $xml_registro .= "<" $lab ">\r\n";
  396.                       }
  397.                       else
  398.                       {
  399.                           $xml_registro .= " Campo=\"" $lab "\"";
  400.                       }
  401.                       $cmp true;
  402.                   }
  403.                   $cada_dado $columns['value'];
  404.                   $cada_tit  $this->trata_dados($this->campo_titulo[$col]);
  405.                   $this->clear_tag($cada_tit);
  406.                   if ($this->New_Format)
  407.                   {
  408.                       $xml_registro .= " <" $cada_tit ">" $cada_dado "</" $cada_tit ">\r\n";
  409.                   }
  410.                   else
  411.                   {
  412.                       $xml_registro .= " " $cada_tit "=\"" $cada_dado "\"";
  413.                   }
  414.                   $col++;
  415.               }
  416.           }
  417.           if ($this->New_Format && $cmp)
  418.           {
  419.               $xml_registro .= "</" $lab ">\r\n";
  420.           }
  421.           if (!$this->New_Format)
  422.           {
  423.               $xml_registro .= " />\r\n";
  424.           }
  425.           fwrite($xml_f$xml_registro);
  426.       }
  427.    }

  428.    //----- 
  429.    function trata_dados($conteudo)
  430.    {
  431.       $str_temp $conteudo;
  432.       $str_temp str_replace("<br />""",  $str_temp);
  433.       $str_temp str_replace("&""&amp;",  $str_temp);
  434.       $str_temp str_replace("<""&lt;",   $str_temp);
  435.       $str_temp str_replace(">""&gt;",   $str_temp);
  436.       $str_temp str_replace("'""&apos;"$str_temp);
  437.       $str_temp str_replace('"'"&quot;",  $str_temp);
  438.       $str_temp str_replace('('"_",  $str_temp);
  439.       $str_temp str_replace(')'"",  $str_temp);
  440.       return ($str_temp);
  441.    }

  442.    function clear_tag(&$conteudo)
  443.    {
  444.       $out = (is_numeric(substr($conteudo01)) || substr($conteudo01) == "") ? "_" "";
  445.       $str_temp "abcdefghijklmnopqrstuwxyz0123456789";
  446.       for ($i 0$i strlen($conteudo); $i++)
  447.       {
  448.           $char substr($conteudo$i1);
  449.           $ok false;
  450.           for ($z 0$z strlen($str_temp); $z++)
  451.           {
  452.               if (strtolower($char) == substr($str_temp$z1))
  453.               {
  454.                   $ok true;
  455.                   break;
  456.               }
  457.           }
  458.           $out .= ($ok) ? $char "_";
  459.       }
  460.       $conteudo $out;
  461.    }

  462.    function nm_conv_data_db($dt_in$form_in$form_out)
  463.    {
  464.        $dt_out $dt_in;
  465.        if (strtoupper($form_in) == "DB_FORMAT")
  466.        {
  467.            if ($dt_out == "null" || $dt_out == "")
  468.            {
  469.                $dt_out "";
  470.                return $dt_out;
  471.            }
  472.            $form_in "AAAA-MM-DD";
  473.        }
  474.        if (strtoupper($form_out) == "DB_FORMAT")
  475.        {
  476.            if (empty($dt_out))
  477.            {
  478.                $dt_out "null";
  479.                return $dt_out;
  480.            }
  481.            $form_out "AAAA-MM-DD";
  482.        }
  483.        nm_conv_form_data($dt_out$form_in$form_out);
  484.        return $dt_out;
  485.    }
  486.    function progress_bar_end()
  487.    {
  488.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file']);
  489.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  490.       {
  491.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  492.       }
  493.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  494.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  495.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  496.       $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  497.       if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  498.           $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  499.       }
  500.       $this->pb->setProgressbarMessage($Mens_bar);
  501.       $this->pb->setDownloadLink($this->Ini->path_imag_temp "/" $this->Arquivo);
  502.       $this->pb->setDownloadMd5($path_doc_md5);
  503.       $this->pb->completed();
  504.    }
  505.    //---- 
  506.    function monta_html()
  507.    {
  508.       global $nm_url_saida;
  509.       include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  510.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file']);
  511.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  512.       {
  513.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  514.       }
  515.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  516.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  517.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  518. ?>
  519. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  520.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  521. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  522. <HEAD>
  523.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: XML</TITLE>
  524.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  525. <?php
  526. if ($_SESSION['scriptcase']['proc_mobile'])
  527. {
  528. ?>
  529.   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  530. <?php
  531. }
  532. ?>
  533.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  534.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  535.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  536.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  537.  <META http-equiv="Pragma" content="no-cache"/>
  538.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  539.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  540.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  541.  <?php
  542.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  543.  {
  544.  ?>
  545.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  546.  <?php
  547.  }
  548.  ?>
  549.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  550. </HEAD>
  551. <BODY class="scExportPage">
  552. <?php echo $this->Ini->Ajax_result_set ?>
  553. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  554.  <table class="scExportTable" align="center">
  555.   <tr>
  556.    <td class="scExportTitle" style="height: 25px">XML</td>
  557.   </tr>
  558.   <tr>
  559.    <td class="scExportLine" style="width: 100%">
  560.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  561.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  562.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  563.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  564.  ?>
  565.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  566.  ?>
  567.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  568.  ?>
  569.     </td></tr></table>
  570.    </td>
  571.   </tr>
  572.  </table>
  573. </td></tr></table>
  574. <form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp "/" $this->Arquivo_view ?>" target="_blank" style="display: none"> 
  575. </form>
  576. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  577. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  578. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  579. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  580. </form>
  581. <FORM name="F0" method=post action="./"> 
  582. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  583. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  584. <INPUT type="hidden" name="nmgp_opcao" value="<?php echo NM_encode_input($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_return']); ?>"> 
  585. </FORM> 
  586. </td></tr></table>
  587. </BODY>
  588. </HTML>
  589. <?php
  590.    }
  591.    function nm_gera_mask(&$nm_campo$nm_mask)
  592.    { 
  593.       $trab_campo $nm_campo;
  594.       $trab_mask  $nm_mask;
  595.       $tam_campo  strlen($nm_campo);
  596.       $trab_saida "";
  597.       $mask_num false;
  598.       for ($x=0$x strlen($trab_mask); $x++)
  599.       {
  600.           if (substr($trab_mask$x1) == "#")
  601.           {
  602.               $mask_num true;
  603.               break;
  604.           }
  605.       }
  606.       if ($mask_num )
  607.       {
  608.           $ver_duas explode(";"$trab_mask);
  609.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  610.           {
  611.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  612.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  613.               if ($cont2 >= $tam_campo)
  614.               {
  615.                   $trab_mask $ver_duas[1];
  616.               }
  617.               else
  618.               {
  619.                   $trab_mask $ver_duas[0];
  620.               }
  621.           }
  622.           $tam_mask strlen($trab_mask);
  623.           $xdados 0;
  624.           for ($x=0$x $tam_mask$x++)
  625.           {
  626.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  627.               {
  628.                   $trab_saida .= substr($trab_campo$xdados1);
  629.                   $xdados++;
  630.               }
  631.               elseif ($xdados $tam_campo)
  632.               {
  633.                   $trab_saida .= substr($trab_mask$x1);
  634.               }
  635.           }
  636.           if ($xdados $tam_campo)
  637.           {
  638.               $trab_saida .= substr($trab_campo$xdados);
  639.           }
  640.           $nm_campo $trab_saida;
  641.           return;
  642.       }
  643.       for ($ix strlen($trab_mask); $ix 0$ix--)
  644.       {
  645.            $char_mask substr($trab_mask$ix 11);
  646.            if ($char_mask != "x" && $char_mask != "z")
  647.            {
  648.                $trab_saida $char_mask $trab_saida;
  649.            }
  650.            else
  651.            {
  652.                if ($tam_campo != 0)
  653.                {
  654.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  655.                    $tam_campo--;
  656.                }
  657.                else
  658.                {
  659.                    $trab_saida "0" $trab_saida;
  660.                }
  661.            }
  662.       }
  663.       if ($tam_campo != 0)
  664.       {
  665.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  666.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  667.       }
  668.    
  669.       $iz 0
  670.       for ($ix 0$ix strlen($trab_mask); $ix++)
  671.       {
  672.            $char_mask substr($trab_mask$ix1);
  673.            if ($char_mask != "x" && $char_mask != "z")
  674.            {
  675.                if ($char_mask == "." || $char_mask == ",")
  676.                {
  677.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  678.                }
  679.                else
  680.                {
  681.                    $iz++;
  682.                }
  683.            }
  684.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  685.            {
  686.                $ix strlen($trab_mask) + 1;
  687.            }
  688.            else
  689.            {
  690.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  691.            }
  692.       }
  693.       $nm_campo $trab_saida;
  694.    } 
  695. }

  696. ?>
Return
grid_new_rtf.class.php
  1. <?php

  2. class grid_new_rtf
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;
  8.    var $nm_data;
  9.    var $Texto_tag;
  10.    var $Arquivo;
  11.    var $Tit_doc;
  12.    var $sc_proc_grid
  13.    var $NM_cmp_hidden = array();

  14.    //---- 
  15.    function __construct()
  16.    {
  17.       $this->nm_data   = new nm_data("en_us");
  18.       $this->Texto_tag "";
  19.    }

  20.    //---- 
  21.    function monta_rtf()
  22.    {
  23.       $this->inicializa_vars();
  24.       $this->gera_texto_tag();
  25.       $this->grava_arquivo_rtf();
  26.       if ($this->Ini->sc_export_ajax)
  27.       {
  28.           $this->Arr_result['file_export']  = NM_charset_to_utf8($this->Rtf_f);
  29.           $this->Arr_result['title_export'] = NM_charset_to_utf8($this->Tit_doc);
  30.           $Temp ob_get_clean();
  31.           if ($Temp !== false && trim($Temp) != "")
  32.           {
  33.               $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  34.           }
  35.           $oJson = new Services_JSON();
  36.           echo $oJson->encode($this->Arr_result);
  37.           exit;
  38.       }
  39.       else
  40.       {
  41.           $this->progress_bar_end();
  42.       }
  43.    }

  44.    //----- 
  45.    function inicializa_vars()
  46.    {
  47.       global $nm_lang;
  48.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  49.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  50.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  51.       require_once($this->Ini->path_aplicacao "grid_new_total.class.php"); 
  52.       $this->Tot      = new grid_new_total($this->Ini->sc_page);
  53.       $this->prep_modulos("Tot");
  54.       $Gb_geral "quebra_geral_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'];
  55.       if (method_exists($this->Tot,$Gb_geral))
  56.       {
  57.           $this->Tot->$Gb_geral();
  58.           $this->count_ger $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1];
  59.       }
  60.       if (!$this->Ini->sc_export_ajax) {
  61.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  62.           $this->pb = new scProgressBar();
  63.           $this->pb->setRoot($this->Ini->root);
  64.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  65.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  66.           $this->pb->initialize();
  67.           $this->pb->setReturnUrl("./");
  68.           $this->pb->setReturnOption('volta_grid');
  69.           $this->pb->setTotalSteps($this->count_ger);
  70.       }
  71.       $this->Arquivo    "sc_rtf";
  72.       $this->Arquivo   .= "_" date("YmdHis") . "_" rand(01000);
  73.       $this->Arquivo   .= "_grid_new";
  74.       $this->Arquivo   .= ".rtf";
  75.       $this->Tit_doc    "grid_new.rtf";
  76.    }
  77.    //---- 
  78.    function prep_modulos($modulo)
  79.    {
  80.       $this->$modulo->Ini    $this->Ini;
  81.       $this->$modulo->Db     $this->Db;
  82.       $this->$modulo->Erro   $this->Erro;
  83.       $this->$modulo->Lookup $this->Lookup;
  84.    }


  85.    //----- 
  86.    function gera_texto_tag()
  87.    {
  88.      global $nm_lang;
  89.       global $nm_nada$nm_lang;

  90.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  91.       $this->sc_proc_grid false
  92.       $nm_raiz_img  ""
  93.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_name']))
  94.       {
  95.           $this->Arquivo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_name'];
  96.           $this->Tit_doc $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_name'];
  97.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_name']);
  98.       }
  99.       if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']))
  100.       {
  101.           foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display'] as $NM_cada_field => $NM_cada_opc)
  102.           {
  103.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  104.           }
  105.       }
  106.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']))
  107.       {
  108.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  109.           {
  110.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  111.           }
  112.       }
  113.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']))
  114.       {
  115.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  116.           {
  117.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  118.           }
  119.       }
  120.       $this->sc_where_orig   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  121.       $this->sc_where_atual  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  122.       $this->sc_where_filtro $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'];
  123.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']))
  124.       { 
  125.           $Busca_temp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'];
  126.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  127.           {
  128.               $Busca_temp NM_conv_charset($Busca_temp$_SESSION['scriptcase']['charset'], "UTF-8");
  129.           }
  130.           $this->proprietarios_idproprietario $Busca_temp['proprietarios_idproprietario']; 
  131.           $tmp_pos strpos($this->proprietarios_idproprietario"##@@");
  132.           if ($tmp_pos !== false && !is_array($this->proprietarios_idproprietario))
  133.           {
  134.               $this->proprietarios_idproprietario substr($this->proprietarios_idproprietario0$tmp_pos);
  135.           }
  136.           $this->proprietarios_nome $Busca_temp['proprietarios_nome']; 
  137.           $tmp_pos strpos($this->proprietarios_nome"##@@");
  138.           if ($tmp_pos !== false && !is_array($this->proprietarios_nome))
  139.           {
  140.               $this->proprietarios_nome substr($this->proprietarios_nome0$tmp_pos);
  141.           }
  142.           $this->proprietarios_sexo $Busca_temp['proprietarios_sexo']; 
  143.           $tmp_pos strpos($this->proprietarios_sexo"##@@");
  144.           if ($tmp_pos !== false && !is_array($this->proprietarios_sexo))
  145.           {
  146.               $this->proprietarios_sexo substr($this->proprietarios_sexo0$tmp_pos);
  147.           }
  148.           $this->proprietarios_cpf $Busca_temp['proprietarios_cpf']; 
  149.           $tmp_pos strpos($this->proprietarios_cpf"##@@");
  150.           if ($tmp_pos !== false && !is_array($this->proprietarios_cpf))
  151.           {
  152.               $this->proprietarios_cpf substr($this->proprietarios_cpf0$tmp_pos);
  153.           }
  154.       } 
  155.       $this->arr_export = array('label' => array(), 'lines' => array());
  156.       $this->arr_span   = array();

  157.       $this->Texto_tag .= "<table>\r\n";
  158.       $this->Texto_tag .= "<tr>\r\n";
  159.       foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_col)
  160.       { 
  161.           $SC_Label = (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario"
  162.           if ($Cada_col == "proprietarios_idproprietario" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  163.           {
  164.               if (!NM_is_utf8($SC_Label))
  165.               {
  166.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  167.               }
  168.               $SC_Label str_replace('<''&lt;'$SC_Label);
  169.               $SC_Label str_replace('>''&gt;'$SC_Label);
  170.               $this->Texto_tag .= "<td>" $SC_Label "</td>\r\n";
  171.           }
  172.           $SC_Label = (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome"
  173.           if ($Cada_col == "proprietarios_nome" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  174.           {
  175.               if (!NM_is_utf8($SC_Label))
  176.               {
  177.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  178.               }
  179.               $SC_Label str_replace('<''&lt;'$SC_Label);
  180.               $SC_Label str_replace('>''&gt;'$SC_Label);
  181.               $this->Texto_tag .= "<td>" $SC_Label "</td>\r\n";
  182.           }
  183.           $SC_Label = (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo"
  184.           if ($Cada_col == "proprietarios_sexo" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  185.           {
  186.               if (!NM_is_utf8($SC_Label))
  187.               {
  188.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  189.               }
  190.               $SC_Label str_replace('<''&lt;'$SC_Label);
  191.               $SC_Label str_replace('>''&gt;'$SC_Label);
  192.               $this->Texto_tag .= "<td>" $SC_Label "</td>\r\n";
  193.           }
  194.           $SC_Label = (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf"
  195.           if ($Cada_col == "proprietarios_cpf" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  196.           {
  197.               if (!NM_is_utf8($SC_Label))
  198.               {
  199.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  200.               }
  201.               $SC_Label str_replace('<''&lt;'$SC_Label);
  202.               $SC_Label str_replace('>''&gt;'$SC_Label);
  203.               $this->Texto_tag .= "<td>" $SC_Label "</td>\r\n";
  204.           }
  205.           $SC_Label = (isset($this->New_label['proprietarios_telefone'])) ? $this->New_label['proprietarios_telefone'] : "Telefone"
  206.           if ($Cada_col == "proprietarios_telefone" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  207.           {
  208.               if (!NM_is_utf8($SC_Label))
  209.               {
  210.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  211.               }
  212.               $SC_Label str_replace('<''&lt;'$SC_Label);
  213.               $SC_Label str_replace('>''&gt;'$SC_Label);
  214.               $this->Texto_tag .= "<td>" $SC_Label "</td>\r\n";
  215.           }
  216.           $SC_Label = (isset($this->New_label['veiculos_idveiculos'])) ? $this->New_label['veiculos_idveiculos'] : "Id Veiculos"
  217.           if ($Cada_col == "veiculos_idveiculos" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  218.           {
  219.               if (!NM_is_utf8($SC_Label))
  220.               {
  221.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  222.               }
  223.               $SC_Label str_replace('<''&lt;'$SC_Label);
  224.               $SC_Label str_replace('>''&gt;'$SC_Label);
  225.               $this->Texto_tag .= "<td>" $SC_Label "</td>\r\n";
  226.           }
  227.           $SC_Label = (isset($this->New_label['veiculos_anomodelo'])) ? $this->New_label['veiculos_anomodelo'] : "Ano Modelo"
  228.           if ($Cada_col == "veiculos_anomodelo" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  229.           {
  230.               if (!NM_is_utf8($SC_Label))
  231.               {
  232.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  233.               }
  234.               $SC_Label str_replace('<''&lt;'$SC_Label);
  235.               $SC_Label str_replace('>''&gt;'$SC_Label);
  236.               $this->Texto_tag .= "<td>" $SC_Label "</td>\r\n";
  237.           }
  238.           $SC_Label = (isset($this->New_label['veiculos_placa'])) ? $this->New_label['veiculos_placa'] : "Placa"
  239.           if ($Cada_col == "veiculos_placa" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  240.           {
  241.               if (!NM_is_utf8($SC_Label))
  242.               {
  243.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  244.               }
  245.               $SC_Label str_replace('<''&lt;'$SC_Label);
  246.               $SC_Label str_replace('>''&gt;'$SC_Label);
  247.               $this->Texto_tag .= "<td>" $SC_Label "</td>\r\n";
  248.           }
  249.           $SC_Label = (isset($this->New_label['proprietarios_endereco'])) ? $this->New_label['proprietarios_endereco'] : "Endereco"
  250.           if ($Cada_col == "proprietarios_endereco" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  251.           {
  252.               if (!NM_is_utf8($SC_Label))
  253.               {
  254.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  255.               }
  256.               $SC_Label str_replace('<''&lt;'$SC_Label);
  257.               $SC_Label str_replace('>''&gt;'$SC_Label);
  258.               $this->Texto_tag .= "<td>" $SC_Label "</td>\r\n";
  259.           }
  260.       } 
  261.       $this->Texto_tag .= "</tr>\r\n";
  262.       $this->nm_field_dinamico = array();
  263.       $this->nm_order_dinamico = array();
  264.       $nmgp_select_count "SELECT count(*) AS countTest from " $this->Ini->nm_tabela
  265.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
  266.       { 
  267.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  268.       } 
  269.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  270.       { 
  271.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  272.       } 
  273.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  274.       { 
  275.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  276.       } 
  277.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  278.       { 
  279.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  280.       } 
  281.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
  282.       { 
  283.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  284.       } 
  285.       else 
  286.       { 
  287.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  288.       } 
  289.       $nmgp_select .= " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  290.       $nmgp_select_count .= " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  291.       $nmgp_order_by $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['order_grid'];
  292.       $nmgp_select .= $nmgp_order_by
  293.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select_count;
  294.       $rt $this->Db->Execute($nmgp_select_count);
  295.       if ($rt === false && !$rt->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1)
  296.       {
  297.          $this->Erro->mensagem(__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg());
  298.          exit;
  299.       }
  300.       $this->count_ger $rt->fields[0];
  301.       $rt->Close();
  302.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select;
  303.       $rs $this->Db->Execute($nmgp_select);
  304.       if ($rs === false && !$rs->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1)
  305.       {
  306.          $this->Erro->mensagem(__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg());
  307.          exit;
  308.       }
  309.       $this->SC_seq_register 0;
  310.       $PB_tot = (isset($this->count_ger) && $this->count_ger 0) ? "/" $this->count_ger "";
  311.       while (!$rs->EOF)
  312.       {
  313.          $this->SC_seq_register++;
  314.          if (!$this->Ini->sc_export_ajax) {
  315.              $Mens_bar $this->Ini->Nm_lang['lang_othr_prcs'];
  316.              if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  317.                  $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  318.              }
  319.              $this->pb->setProgressbarMessage($Mens_bar ": " $this->SC_seq_register $PB_tot);
  320.              $this->pb->addSteps(1);
  321.          }
  322.          $this->Texto_tag .= "<tr>\r\n";
  323.          $this->proprietarios_idproprietario $rs->fields[0] ;  
  324.          $this->proprietarios_idproprietario = (string)$this->proprietarios_idproprietario;
  325.          $this->proprietarios_nome $rs->fields[1] ;  
  326.          $this->proprietarios_sexo $rs->fields[2] ;  
  327.          $this->proprietarios_cpf $rs->fields[3] ;  
  328.          $this->proprietarios_cpf = (string)$this->proprietarios_cpf;
  329.          $this->proprietarios_telefone $rs->fields[4] ;  
  330.          $this->veiculos_idveiculos $rs->fields[5] ;  
  331.          $this->veiculos_idveiculos = (string)$this->veiculos_idveiculos;
  332.          $this->veiculos_anomodelo $rs->fields[6] ;  
  333.          $this->veiculos_placa $rs->fields[7] ;  
  334.          $this->proprietarios_endereco $rs->fields[8] ;  
  335.          $this->sc_proc_grid true
  336.          foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_col)
  337.          { 
  338.             if (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off")
  339.             { 
  340.                 $NM_func_exp "NM_export_" $Cada_col;
  341.                 $this->$NM_func_exp();
  342.             } 
  343.          } 
  344.          $this->Texto_tag .= "</tr>\r\n";
  345.          $rs->MoveNext();
  346.       }
  347.       $this->Texto_tag .= "</table>\r\n";
  348.       if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']))
  349.       {
  350.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order'];
  351.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']);
  352.       }
  353.       if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']))
  354.       {
  355.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel'];
  356.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']);
  357.       }
  358.       $rs->Close();
  359.    }
  360.    //----- proprietarios_idproprietario
  361.    function NM_export_proprietarios_idproprietario()
  362.    {
  363.          nmgp_Form_Num_Val($this->proprietarios_idproprietario$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  364.          if (!NM_is_utf8($this->proprietarios_idproprietario))
  365.          {
  366.              $this->proprietarios_idproprietario sc_convert_encoding($this->proprietarios_idproprietario"UTF-8"$_SESSION['scriptcase']['charset']);
  367.          }
  368.          $this->proprietarios_idproprietario str_replace('<''&lt;'$this->proprietarios_idproprietario);
  369.          $this->proprietarios_idproprietario str_replace('>''&gt;'$this->proprietarios_idproprietario);
  370.          $this->Texto_tag .= "<td>" $this->proprietarios_idproprietario "</td>\r\n";
  371.    }
  372.    //----- proprietarios_nome
  373.    function NM_export_proprietarios_nome()
  374.    {
  375.          $this->proprietarios_nome html_entity_decode($this->proprietarios_nomeENT_COMPAT$_SESSION['scriptcase']['charset']);
  376.          $this->proprietarios_nome strip_tags($this->proprietarios_nome);
  377.          if (!NM_is_utf8($this->proprietarios_nome))
  378.          {
  379.              $this->proprietarios_nome sc_convert_encoding($this->proprietarios_nome"UTF-8"$_SESSION['scriptcase']['charset']);
  380.          }
  381.          $this->proprietarios_nome str_replace('<''&lt;'$this->proprietarios_nome);
  382.          $this->proprietarios_nome str_replace('>''&gt;'$this->proprietarios_nome);
  383.          $this->Texto_tag .= "<td>" $this->proprietarios_nome "</td>\r\n";
  384.    }
  385.    //----- proprietarios_sexo
  386.    function NM_export_proprietarios_sexo()
  387.    {
  388.          $this->proprietarios_sexo html_entity_decode($this->proprietarios_sexoENT_COMPAT$_SESSION['scriptcase']['charset']);
  389.          $this->proprietarios_sexo strip_tags($this->proprietarios_sexo);
  390.          if (!NM_is_utf8($this->proprietarios_sexo))
  391.          {
  392.              $this->proprietarios_sexo sc_convert_encoding($this->proprietarios_sexo"UTF-8"$_SESSION['scriptcase']['charset']);
  393.          }
  394.          $this->proprietarios_sexo str_replace('<''&lt;'$this->proprietarios_sexo);
  395.          $this->proprietarios_sexo str_replace('>''&gt;'$this->proprietarios_sexo);
  396.          $this->Texto_tag .= "<td>" $this->proprietarios_sexo "</td>\r\n";
  397.    }
  398.    //----- proprietarios_cpf
  399.    function NM_export_proprietarios_cpf()
  400.    {
  401.          nmgp_Form_Num_Val($this->proprietarios_cpf$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  402.          if (!NM_is_utf8($this->proprietarios_cpf))
  403.          {
  404.              $this->proprietarios_cpf sc_convert_encoding($this->proprietarios_cpf"UTF-8"$_SESSION['scriptcase']['charset']);
  405.          }
  406.          $this->proprietarios_cpf str_replace('<''&lt;'$this->proprietarios_cpf);
  407.          $this->proprietarios_cpf str_replace('>''&gt;'$this->proprietarios_cpf);
  408.          $this->Texto_tag .= "<td>" $this->proprietarios_cpf "</td>\r\n";
  409.    }
  410.    //----- proprietarios_telefone
  411.    function NM_export_proprietarios_telefone()
  412.    {
  413.          $this->proprietarios_telefone html_entity_decode($this->proprietarios_telefoneENT_COMPAT$_SESSION['scriptcase']['charset']);
  414.          $this->proprietarios_telefone strip_tags($this->proprietarios_telefone);
  415.          if (!NM_is_utf8($this->proprietarios_telefone))
  416.          {
  417.              $this->proprietarios_telefone sc_convert_encoding($this->proprietarios_telefone"UTF-8"$_SESSION['scriptcase']['charset']);
  418.          }
  419.          $this->proprietarios_telefone str_replace('<''&lt;'$this->proprietarios_telefone);
  420.          $this->proprietarios_telefone str_replace('>''&gt;'$this->proprietarios_telefone);
  421.          $this->Texto_tag .= "<td>" $this->proprietarios_telefone "</td>\r\n";
  422.    }
  423.    //----- veiculos_idveiculos
  424.    function NM_export_veiculos_idveiculos()
  425.    {
  426.          nmgp_Form_Num_Val($this->veiculos_idveiculos$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  427.          if (!NM_is_utf8($this->veiculos_idveiculos))
  428.          {
  429.              $this->veiculos_idveiculos sc_convert_encoding($this->veiculos_idveiculos"UTF-8"$_SESSION['scriptcase']['charset']);
  430.          }
  431.          $this->veiculos_idveiculos str_replace('<''&lt;'$this->veiculos_idveiculos);
  432.          $this->veiculos_idveiculos str_replace('>''&gt;'$this->veiculos_idveiculos);
  433.          $this->Texto_tag .= "<td>" $this->veiculos_idveiculos "</td>\r\n";
  434.    }
  435.    //----- veiculos_anomodelo
  436.    function NM_export_veiculos_anomodelo()
  437.    {
  438.          $this->veiculos_anomodelo html_entity_decode($this->veiculos_anomodeloENT_COMPAT$_SESSION['scriptcase']['charset']);
  439.          $this->veiculos_anomodelo strip_tags($this->veiculos_anomodelo);
  440.          if (!NM_is_utf8($this->veiculos_anomodelo))
  441.          {
  442.              $this->veiculos_anomodelo sc_convert_encoding($this->veiculos_anomodelo"UTF-8"$_SESSION['scriptcase']['charset']);
  443.          }
  444.          $this->veiculos_anomodelo str_replace('<''&lt;'$this->veiculos_anomodelo);
  445.          $this->veiculos_anomodelo str_replace('>''&gt;'$this->veiculos_anomodelo);
  446.          $this->Texto_tag .= "<td>" $this->veiculos_anomodelo "</td>\r\n";
  447.    }
  448.    //----- veiculos_placa
  449.    function NM_export_veiculos_placa()
  450.    {
  451.          $this->veiculos_placa html_entity_decode($this->veiculos_placaENT_COMPAT$_SESSION['scriptcase']['charset']);
  452.          $this->veiculos_placa strip_tags($this->veiculos_placa);
  453.          if (!NM_is_utf8($this->veiculos_placa))
  454.          {
  455.              $this->veiculos_placa sc_convert_encoding($this->veiculos_placa"UTF-8"$_SESSION['scriptcase']['charset']);
  456.          }
  457.          $this->veiculos_placa str_replace('<''&lt;'$this->veiculos_placa);
  458.          $this->veiculos_placa str_replace('>''&gt;'$this->veiculos_placa);
  459.          $this->Texto_tag .= "<td>" $this->veiculos_placa "</td>\r\n";
  460.    }
  461.    //----- proprietarios_endereco
  462.    function NM_export_proprietarios_endereco()
  463.    {
  464.          $this->proprietarios_endereco html_entity_decode($this->proprietarios_enderecoENT_COMPAT$_SESSION['scriptcase']['charset']);
  465.          $this->proprietarios_endereco strip_tags($this->proprietarios_endereco);
  466.          if (!NM_is_utf8($this->proprietarios_endereco))
  467.          {
  468.              $this->proprietarios_endereco sc_convert_encoding($this->proprietarios_endereco"UTF-8"$_SESSION['scriptcase']['charset']);
  469.          }
  470.          $this->proprietarios_endereco str_replace('<''&lt;'$this->proprietarios_endereco);
  471.          $this->proprietarios_endereco str_replace('>''&gt;'$this->proprietarios_endereco);
  472.          $this->Texto_tag .= "<td>" $this->proprietarios_endereco "</td>\r\n";
  473.    }

  474.    //----- 
  475.    function grava_arquivo_rtf()
  476.    {
  477.       global $nm_lang$doc_wrap;
  478.       $this->Rtf_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  479.       $rtf_f       fopen($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo"w");
  480.       require_once($this->Ini->path_third      "/rtf_new/document_generator/cl_xml2driver.php"); 
  481.       $text_ok  =  "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"
  482.       $text_ok .=  "<DOC config_file=\"" $this->Ini->path_third "/rtf_new/doc_config.inc\" >\r\n"
  483.       $text_ok .=  $this->Texto_tag
  484.       $text_ok .=  "</DOC>\r\n"
  485.       $xml = new nDOCGEN($text_ok,"RTF"); 
  486.       fwrite($rtf_f$xml->get_result_file());
  487.       fclose($rtf_f);
  488.    }

  489.    function nm_conv_data_db($dt_in$form_in$form_out)
  490.    {
  491.        $dt_out $dt_in;
  492.        if (strtoupper($form_in) == "DB_FORMAT")
  493.        {
  494.            if ($dt_out == "null" || $dt_out == "")
  495.            {
  496.                $dt_out "";
  497.                return $dt_out;
  498.            }
  499.            $form_in "AAAA-MM-DD";
  500.        }
  501.        if (strtoupper($form_out) == "DB_FORMAT")
  502.        {
  503.            if (empty($dt_out))
  504.            {
  505.                $dt_out "null";
  506.                return $dt_out;
  507.            }
  508.            $form_out "AAAA-MM-DD";
  509.        }
  510.        nm_conv_form_data($dt_out$form_in$form_out);
  511.        return $dt_out;
  512.    }
  513.    function progress_bar_end()
  514.    {
  515.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_file']);
  516.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  517.       {
  518.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  519.       }
  520.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  521.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  522.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  523.       $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  524.       if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  525.           $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  526.       }
  527.       $this->pb->setProgressbarMessage($Mens_bar);
  528.       $this->pb->setDownloadLink($this->Ini->path_imag_temp "/" $this->Arquivo);
  529.       $this->pb->setDownloadMd5($path_doc_md5);
  530.       $this->pb->completed();
  531.    }
  532.    //---- 
  533.    function monta_html()
  534.    {
  535.       global $nm_url_saida$nm_lang;
  536.       include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  537.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_file']);
  538.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  539.       {
  540.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['rtf_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  541.       }
  542.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  543.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  544.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  545. ?>
  546. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  547.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  548. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  549. <HEAD>
  550.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: RTF</TITLE>
  551.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  552. <?php
  553. if ($_SESSION['scriptcase']['proc_mobile'])
  554. {
  555. ?>
  556.   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  557. <?php
  558. }
  559. ?>
  560.   <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  561.   <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  562.   <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  563.   <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  564.   <META http-equiv="Pragma" content="no-cache"/>
  565.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  566.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  567.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  568.  <?php
  569.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  570.  {
  571.  ?>
  572.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  573.  <?php
  574.  }
  575.  ?>
  576.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  577. </HEAD>
  578. <BODY class="scExportPage">
  579. <?php echo $this->Ini->Ajax_result_set ?>
  580. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  581.  <table class="scExportTable" align="center">
  582.   <tr>
  583.    <td class="scExportTitle" style="height: 25px">RTF</td>
  584.   </tr>
  585.   <tr>
  586.    <td class="scExportLine" style="width: 100%">
  587.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  588.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  589.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  590.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  591.  ?>
  592.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  593.  ?>
  594.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  595.  ?>
  596.     </td></tr></table>
  597.    </td>
  598.   </tr>
  599.  </table>
  600. </td></tr></table>
  601. <form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp "/" $this->Arquivo ?>" target="_blank" style="display: none"> 
  602. </form>
  603. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  604. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  605. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  606. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  607. </form>
  608. <FORM name="F0" method=post action="./"> 
  609. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  610. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  611. <INPUT type="hidden" name="nmgp_opcao" value="volta_grid"> 
  612. </FORM> 
  613. </BODY>
  614. </HTML>
  615. <?php
  616.    }
  617.    function nm_gera_mask(&$nm_campo$nm_mask)
  618.    { 
  619.       $trab_campo $nm_campo;
  620.       $trab_mask  $nm_mask;
  621.       $tam_campo  strlen($nm_campo);
  622.       $trab_saida "";
  623.       $mask_num false;
  624.       for ($x=0$x strlen($trab_mask); $x++)
  625.       {
  626.           if (substr($trab_mask$x1) == "#")
  627.           {
  628.               $mask_num true;
  629.               break;
  630.           }
  631.       }
  632.       if ($mask_num )
  633.       {
  634.           $ver_duas explode(";"$trab_mask);
  635.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  636.           {
  637.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  638.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  639.               if ($cont2 >= $tam_campo)
  640.               {
  641.                   $trab_mask $ver_duas[1];
  642.               }
  643.               else
  644.               {
  645.                   $trab_mask $ver_duas[0];
  646.               }
  647.           }
  648.           $tam_mask strlen($trab_mask);
  649.           $xdados 0;
  650.           for ($x=0$x $tam_mask$x++)
  651.           {
  652.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  653.               {
  654.                   $trab_saida .= substr($trab_campo$xdados1);
  655.                   $xdados++;
  656.               }
  657.               elseif ($xdados $tam_campo)
  658.               {
  659.                   $trab_saida .= substr($trab_mask$x1);
  660.               }
  661.           }
  662.           if ($xdados $tam_campo)
  663.           {
  664.               $trab_saida .= substr($trab_campo$xdados);
  665.           }
  666.           $nm_campo $trab_saida;
  667.           return;
  668.       }
  669.       for ($ix strlen($trab_mask); $ix 0$ix--)
  670.       {
  671.            $char_mask substr($trab_mask$ix 11);
  672.            if ($char_mask != "x" && $char_mask != "z")
  673.            {
  674.                $trab_saida $char_mask $trab_saida;
  675.            }
  676.            else
  677.            {
  678.                if ($tam_campo != 0)
  679.                {
  680.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  681.                    $tam_campo--;
  682.                }
  683.                else
  684.                {
  685.                    $trab_saida "0" $trab_saida;
  686.                }
  687.            }
  688.       }
  689.       if ($tam_campo != 0)
  690.       {
  691.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  692.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  693.       }
  694.    
  695.       $iz 0
  696.       for ($ix 0$ix strlen($trab_mask); $ix++)
  697.       {
  698.            $char_mask substr($trab_mask$ix1);
  699.            if ($char_mask != "x" && $char_mask != "z")
  700.            {
  701.                if ($char_mask == "." || $char_mask == ",")
  702.                {
  703.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  704.                }
  705.                else
  706.                {
  707.                    $iz++;
  708.                }
  709.            }
  710.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  711.            {
  712.                $ix strlen($trab_mask) + 1;
  713.            }
  714.            else
  715.            {
  716.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  717.            }
  718.       }
  719.       $nm_campo $trab_saida;
  720.    } 
  721. }

  722. ?>
Return
grid_new_save_grid.php
  1. <?php
  2. include_once('grid_new_session.php');
  3. session_start();
  4. $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  5. //check tmp
  6. if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  7. {
  8.     $str_path_apl_url $_SERVER['PHP_SELF'];
  9.     $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  10.     $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  11.     $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  12.     /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  13. }
  14. if (!isset($_SESSION['sc_session']))
  15. {
  16.     $NM_dir_atual getcwd();
  17.     if (empty($NM_dir_atual))
  18.     {
  19.         $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  20.         $str_path_sys  str_replace("\\"'/'$str_path_sys);
  21.     }
  22.     else
  23.     {
  24.         $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  25.         $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  26.     }
  27.     $str_path_web    $_SERVER['PHP_SELF'];
  28.     $str_path_web    str_replace("\\"'/'$str_path_web);
  29.     $str_path_web    str_replace('//''/'$str_path_web);
  30.     $root            substr($str_path_sys0, -strlen($str_path_web));
  31.     if (is_file($root $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/sc_apl_default_Projeto7.txt"))
  32.     {
  33. ?>
  34.         <script language="javascript">
  35.          parent.nm_move();
  36.         </script>
  37. <?php
  38.         exit;
  39.     }
  40. }
  41. if (!function_exists("NM_is_utf8"))
  42. {
  43.     include_once("../_lib/lib/php/nm_utf8.php");
  44. }
  45. if (!class_exists('Services_JSON'))
  46. {
  47.     include_once("grid_new_json.php");
  48. }
  49. $Save_Grid = new grid_new_Save_Grid(); 
  50. $Save_Grid->Save_Grid_init();

  51. class grid_new_Save_Grid
  52. {
  53.     function Save_Grid_init()
  54.     {
  55.        global $_POST$_GET;
  56.        $this->proc_ajax false;
  57.        if (isset($_POST['script_case_init']))
  58.        {
  59.            $this->sc_init      filter_input(INPUT_POST'script_case_init'FILTER_SANITIZE_NUMBER_INT);
  60.            $this->path_img     filter_input(INPUT_POST'path_img'FILTER_SANITIZE_STRING);
  61.            $this->path_btn     filter_input(INPUT_POST'path_btn'FILTER_SANITIZE_STRING);
  62.            $this->session      filter_input(INPUT_POST'script_case_session'FILTER_SANITIZE_STRING);
  63.            $this->embbed       = isset($_POST['embbed_groupby']) && 'Y' == $_POST['embbed_groupby'];
  64.            $this->tbar_pos     filter_input(INPUT_POST'toolbar_pos'FILTER_SANITIZE_SPECIAL_CHARS);
  65.            $this->sc_origem    filter_input(INPUT_POST'script_origem'FILTER_SANITIZE_STRING);
  66.        }
  67.        elseif (isset($_GET['script_case_init']))
  68.        {
  69.            $this->sc_init      filter_input(INPUT_GET'script_case_init'FILTER_SANITIZE_NUMBER_INT);
  70.            $this->path_img     filter_input(INPUT_GET'path_img'FILTER_SANITIZE_STRING);
  71.            $this->path_btn     filter_input(INPUT_GET'path_btn'FILTER_SANITIZE_STRING);
  72.            $this->session      filter_input(INPUT_GET'script_case_session'FILTER_SANITIZE_STRING);
  73.            $this->embbed       = isset($_GET['embbed_groupby']) && 'Y' == $_GET['embbed_groupby'];
  74.            $this->tbar_pos     filter_input(INPUT_GET'toolbar_pos'FILTER_SANITIZE_SPECIAL_CHARS);
  75.            $this->sc_origem    filter_input(INPUT_GET'script_origem'FILTER_SANITIZE_STRING);
  76.        }
  77.        else
  78.        {
  79.            exit;
  80.        }
  81.        if (isset($_POST['ajax_ctrl']) && $_POST['ajax_ctrl'] == "proc_ajax")
  82.        {
  83.            $this->proc_ajax true;
  84.        }
  85.        $this->ajax_return = array();
  86.        $this->path_grid_sv $_SESSION['sc_session'][$this->sc_init]['grid_new']['path_grid_sv'];
  87.        if (!isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['prim_save_grid']))
  88.        {
  89.            $_SESSION['sc_session'][$this->sc_init]['grid_new']['prim_save_grid'] = true;
  90.        }
  91.        if (isset($_POST['Fsave_ok']) && $_POST['Fsave_ok'] == "default")
  92.        {
  93.            $this->Sel_restore_conf_grid();
  94.        }
  95.        elseif (isset($_POST['Fsave_ok']) && $_POST['Fsave_ok'] == "save_conf_grid")
  96.        {
  97.            $this->Sel_save_conf_grid($_POST['parm']);
  98.        }
  99.        elseif (isset($_POST['Fsave_ok']) && $_POST['Fsave_ok'] == "select_conf_grid")
  100.        {
  101.            $this->Sel_select_conf_grid($_POST['parm']);
  102.        }
  103.        elseif (isset($_POST['Fsave_ok']) && $_POST['Fsave_ok'] == "delete_conf_grid")
  104.        {
  105.            $this->Sel_delete_conf_grid($_POST['parm']);
  106.        }
  107.        if ($this->embbed)
  108.        {
  109.            ob_start();
  110.            $this->Save_processa_form();
  111.            $Temp ob_get_clean();
  112.            echo NM_charset_to_utf8($Temp);
  113.        }
  114.        else
  115.        {
  116.            $this->Save_processa_form();
  117.        }
  118.        exit;
  119.     }

  120.     function Sel_return_apl()
  121.     {
  122.        $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_ant'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq'];
  123.        $_SESSION['sc_session'][$this->sc_init]['grid_new']['contr_array_resumo'] = "NAO";
  124.        $_SESSION['sc_session'][$this->sc_init]['grid_new']['contr_total_geral']  = "NAO";
  125.        unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral']);
  126.        $this->ajax_return['exit'] = "ok";
  127.        $this->ajax_return['setDisplay'][] = array('field' => 'id_btn_Brestore''value' => (!$_SESSION['sc_session'][$this->sc_init]['grid_new']['prim_save_grid'])?'':'none');
  128.        ob_end_clean();
  129.        $oJson = new Services_JSON();
  130.        echo $oJson->encode($this->ajax_return);
  131.        exit;
  132.     }

  133.     function Sel_clear_conf_grid()
  134.     {
  135.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby']);
  136.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp']);
  137.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql']);
  138.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order']);
  139.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig']);
  140.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_display']);
  141.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel']);
  142.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_select']);
  143.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra']);
  144.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_filtro']);
  145.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq']);
  146.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_pesq']);
  147.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['campos_busca']);
  148.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search']);
  149.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_op']);
  150.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_out']);
  151.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_dyn_search']);
  152.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['Grid_search']);
  153.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['grid_pesq']);
  154.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_grid']);
  155.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_ant']);
  156.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_desc']);
  157.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_cmp']);
  158.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_order']);
  159.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_display']);
  160.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral']);
  161.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_group_by']);
  162.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_x_axys']);
  163.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_y_axys']);
  164.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_fill']);
  165.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order']);
  166.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_col']);
  167.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_level']);
  168.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_sort']);
  169.         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_tabular']);
  170.     }

  171.     function Sel_restore_conf_grid()
  172.     {
  173.         $this->Sel_clear_conf_grid();
  174.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby_SV']))
  175.         {
  176.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby_SV'];
  177.         }
  178.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp_SV']))
  179.         {
  180.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp_SV'];
  181.         }
  182.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql_SV']))
  183.         {
  184.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql_SV'];
  185.         }
  186.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_SV']))
  187.         {
  188.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_SV'];
  189.         }
  190.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig_SV']))
  191.         {
  192.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig_SV'];
  193.         }
  194.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_display_SV']))
  195.         {
  196.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_display'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_display_SV'];
  197.         }
  198.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel_SV']))
  199.         {
  200.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel_SV'];
  201.         }
  202.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_select_SV']))
  203.         {
  204.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_select'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_select_SV'];
  205.         }
  206.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra_SV']))
  207.         {
  208.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra_SV'];
  209.         }
  210.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_filtro_SV']))
  211.         {
  212.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_filtro'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_filtro_SV'];
  213.         }
  214.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_SV']))
  215.         {
  216.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_SV'];
  217.         }
  218.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_pesq_SV']))
  219.         {
  220.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_pesq'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_pesq_SV'];
  221.         }
  222.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['campos_busca_SV']))
  223.         {
  224.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['campos_busca'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['campos_busca_SV'];
  225.         }
  226.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_SV']))
  227.         {
  228.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_SV'];
  229.         }
  230.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_op_SV']))
  231.         {
  232.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_op'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_op_SV'];
  233.         }
  234.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_out_SV']))
  235.         {
  236.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_out'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_out_SV'];
  237.         }
  238.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_dyn_search_SV']))
  239.         {
  240.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_dyn_search'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_dyn_search_SV'];
  241.         }
  242.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['Grid_search_SV']))
  243.         {
  244.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['Grid_search'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['Grid_search_SV'];
  245.         }
  246.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['grid_pesq_SV']))
  247.         {
  248.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['grid_pesq'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['grid_pesq_SV'];
  249.         }
  250.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_grid_SV']))
  251.         {
  252.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_grid'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_grid_SV'];
  253.         }
  254.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_ant_SV']))
  255.         {
  256.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_ant'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_ant_SV'];
  257.         }
  258.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_desc_SV']))
  259.         {
  260.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_desc'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_desc_SV'];
  261.         }
  262.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_cmp_SV']))
  263.         {
  264.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_cmp'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_cmp_SV'];
  265.         }
  266.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_order_SV']))
  267.         {
  268.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_order'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_order_SV'];
  269.         }
  270.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_display_SV']))
  271.         {
  272.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_display'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_display_SV'];
  273.         }
  274.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral_SV']))
  275.         {
  276.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral_SV'];
  277.         }
  278.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_group_by_SV']))
  279.         {
  280.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_group_by'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_group_by_SV'];
  281.         }
  282.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_x_axys_SV']))
  283.         {
  284.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_x_axys'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_x_axys_SV'];
  285.         }
  286.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_y_axys_SV']))
  287.         {
  288.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_y_axys'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_y_axys_SV'];
  289.         }
  290.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_fill_SV']))
  291.         {
  292.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_fill'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_fill_SV'];
  293.         }
  294.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_SV']))
  295.         {
  296.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_SV'];
  297.         }
  298.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_col_SV']))
  299.         {
  300.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_col'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_col_SV'];
  301.         }
  302.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_level_SV']))
  303.         {
  304.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_level'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_level_SV'];
  305.         }
  306.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_sort_SV']))
  307.         {
  308.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_sort'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_sort_SV'];
  309.         }
  310.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_tabular_SV']))
  311.         {
  312.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_tabular'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_tabular_SV'];
  313.         }
  314.         $_SESSION['sc_session'][$this->sc_init]['grid_new']['prim_save_grid'] = true;
  315.         $this->Sel_return_apl();
  316.     }

  317.     function Sel_save_conf_grid($parms)
  318.     {
  319.         $NM_str_save = array();
  320.         $cada_parm   explode('*NM@'$parms);
  321.         $save_option $cada_parm[0];
  322.         $save_name   $cada_parm[1];
  323.         $NM_str_save[] = "str@NMF@SC_Save_Name@NMF@" $save_name "@NMF@";
  324.         $save_name str_replace('/'' '$save_name);
  325.         $save_name str_replace('\\'' '$save_name);
  326.         $save_name str_replace('.'' '$save_name);
  327.         if (!NM_is_utf8($save_name))
  328.         {
  329.             $save_name sc_convert_encoding($save_name"UTF-8"$_SESSION['scriptcase']['charset']);
  330.         }
  331.         $NM_patch $this->path_grid_sv;
  332.         if (!is_dir($NM_patch))
  333.         {
  334.             $NMdir mkdir($NM_patch0755);
  335.         }
  336.         $NM_patch .= "Projeto7/";
  337.         if (!is_dir($NM_patch))
  338.         {
  339.             $NMdir mkdir($NM_patch0755);
  340.         }
  341.         $NM_patch .= "grid_new/";
  342.         if (!is_dir($NM_patch))
  343.         {
  344.             $NMdir mkdir($NM_patch0755);
  345.         }
  346.         $Parms_usr  "";
  347.         $NM_arq_grid fopen ($NM_patch $save_name'w');

  348.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby']))
  349.         {
  350.             $NM_str_save[] = "str@NMF@SC_Ind_Groupby@NMF@" $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby'] . "@NMF@";
  351.         }
  352.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp']))
  353.         {
  354.             $NM_str_save[] = "arr@NMF@SC_Gb_Free_cmp@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp']) . "@NMF@";
  355.         }
  356.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql']))
  357.         {
  358.             $NM_str_save[] = "arr@NMF@SC_Gb_Free_sql@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql']) . "@NMF@";
  359.         }
  360.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order']))
  361.         {
  362.             $NM_str_save[] = "arr@NMF@field_order@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order']) . "@NMF@";
  363.         }
  364.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig']))
  365.         {
  366.             $NM_str_save[] = "arr@NMF@field_order_orig@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig']) . "@NMF@";
  367.         }
  368.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_display']))
  369.         {
  370.             $NM_str_save[] = "arr@NMF@field_display@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_display']) . "@NMF@";
  371.         }
  372.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel']))
  373.         {
  374.             $NM_str_save[] = "arr@NMF@usr_cmp_sel@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel']) . "@NMF@";
  375.         }
  376.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_select']))
  377.         {
  378.             $NM_str_save[] = "arr@NMF@ordem_select@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_select']) . "@NMF@";
  379.         }
  380.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra']))
  381.         {
  382.             $NM_str_save[] = "arr@NMF@ordem_quebra@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra']) . "@NMF@";
  383.         }
  384.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_filtro']))
  385.         {
  386.             $NM_str_save[] = "str@NMF@where_pesq_filtro@NMF@" $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_filtro'] . "@NMF@";
  387.         }
  388.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq']))
  389.         {
  390.             $NM_str_save[] = "str@NMF@where_pesq@NMF@" $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq'] . "@NMF@";
  391.         }
  392.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_pesq']))
  393.         {
  394.             $NM_str_save[] = "str@NMF@cond_pesq@NMF@" $_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_pesq'] . "@NMF@";
  395.         }
  396.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['campos_busca']))
  397.         {
  398.             $NM_str_save[] = "arr@NMF@campos_busca@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['campos_busca']) . "@NMF@";
  399.         }
  400.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search']))
  401.         {
  402.             $NM_str_save[] = "arr@NMF@dyn_search@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search']) . "@NMF@";
  403.         }
  404.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_op']))
  405.         {
  406.             $NM_str_save[] = "str@NMF@dyn_search_op@NMF@" $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_op'] . "@NMF@";
  407.         }
  408.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_out']))
  409.         {
  410.             $NM_str_save[] = "arr@NMF@dyn_search_out@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_out']) . "@NMF@";
  411.         }
  412.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_dyn_search']))
  413.         {
  414.             $NM_str_save[] = "arr@NMF@cond_dyn_search@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_dyn_search']) . "@NMF@";
  415.         }
  416.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['Grid_search']))
  417.         {
  418.             $NM_str_save[] = "arr@NMF@Grid_search@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['Grid_search']) . "@NMF@";
  419.         }
  420.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['grid_pesq']))
  421.         {
  422.             $NM_str_save[] = "arr@NMF@grid_pesq@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['grid_pesq']) . "@NMF@";
  423.         }
  424.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_grid']))
  425.         {
  426.             $NM_str_save[] = "str@NMF@ordem_grid@NMF@" $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_grid'] . "@NMF@";
  427.         }
  428.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_ant']))
  429.         {
  430.             $NM_str_save[] = "str@NMF@ordem_ant@NMF@" $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_ant'] . "@NMF@";
  431.         }
  432.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_desc']))
  433.         {
  434.             $NM_str_save[] = "str@NMF@ordem_desc@NMF@" $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_desc'] . "@NMF@";
  435.         }
  436.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_cmp']))
  437.         {
  438.             $NM_str_save[] = "str@NMF@ordem_cmp@NMF@" $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_cmp'] . "@NMF@";
  439.         }
  440.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_order']))
  441.         {
  442.             $NM_str_save[] = "arr@NMF@summarizing_fields_order@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_order']) . "@NMF@";
  443.         }
  444.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_display']))
  445.         {
  446.             $NM_str_save[] = "arr@NMF@summarizing_fields_display@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_display']) . "@NMF@";
  447.         }
  448.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral']))
  449.         {
  450.             $NM_str_save[] = "arr@NMF@tot_geral@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral']) . "@NMF@";
  451.         }
  452.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_group_by']))
  453.         {
  454.             $NM_str_save[] = "arr@NMF@pivot_group_by@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_group_by']) . "@NMF@";
  455.         }
  456.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_x_axys']))
  457.         {
  458.             $NM_str_save[] = "arr@NMF@pivot_x_axys@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_x_axys']) . "@NMF@";
  459.         }
  460.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_y_axys']))
  461.         {
  462.             $NM_str_save[] = "arr@NMF@pivot_y_axys@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_y_axys']) . "@NMF@";
  463.         }
  464.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_fill']))
  465.         {
  466.             $NM_str_save[] = "arr@NMF@pivot_fill@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_fill']) . "@NMF@";
  467.         }
  468.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order']))
  469.         {
  470.             $NM_str_save[] = "arr@NMF@pivot_order@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order']) . "@NMF@";
  471.         }
  472.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_col']))
  473.         {
  474.             $NM_str_save[] = "arr@NMF@pivot_order_col@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_col']) . "@NMF@";
  475.         }
  476.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_level']))
  477.         {
  478.             $NM_str_save[] = "arr@NMF@pivot_order_level@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_level']) . "@NMF@";
  479.         }
  480.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_sort']))
  481.         {
  482.             $NM_str_save[] = "arr@NMF@pivot_order_sort@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_sort']) . "@NMF@";
  483.         }
  484.         if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_tabular']))
  485.         {
  486.             $NM_str_save[] = "arr@NMF@pivot_tabular@NMF@" serialize($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_tabular']) . "@NMF@";
  487.         }

  488.         foreach ($NM_str_save as $ind => $cada_lin_save)
  489.         {
  490.             if (!NM_is_utf8($cada_lin_save))
  491.             {
  492.                $cada_lin_save sc_convert_encoding($cada_lin_save"UTF-8"$_SESSION['scriptcase']['charset']);
  493.             }
  494.             fwrite($NM_arq_grid$cada_lin_save "\r\n");
  495.         }
  496.         fclose($NM_arq_grid);
  497.     }

  498.     function Sel_select_conf_grid($NM_arq_save)
  499.     {
  500.         if ($_SESSION['sc_session'][$this->sc_init]['grid_new']['prim_save_grid'])
  501.         {
  502.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby']))
  503.             {
  504.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby'];
  505.             }
  506.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp']))
  507.             {
  508.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp'];
  509.             }
  510.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql']))
  511.             {
  512.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql'];
  513.             }
  514.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order']))
  515.             {
  516.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'];
  517.             }
  518.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig']))
  519.             {
  520.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig'];
  521.             }
  522.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_display']))
  523.             {
  524.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_display_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_display'];
  525.             }
  526.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel']))
  527.             {
  528.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel'];
  529.             }
  530.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_select']))
  531.             {
  532.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_select_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_select'];
  533.             }
  534.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra']))
  535.             {
  536.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra'];
  537.             }
  538.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_filtro']))
  539.             {
  540.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_filtro_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_filtro'];
  541.             }
  542.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq']))
  543.             {
  544.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['where_pesq'];
  545.             }
  546.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_pesq']))
  547.             {
  548.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_pesq_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_pesq'];
  549.             }
  550.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['campos_busca']))
  551.             {
  552.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['campos_busca_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['campos_busca'];
  553.             }
  554.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search']))
  555.             {
  556.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search'];
  557.             }
  558.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_op']))
  559.             {
  560.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_op_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_op'];
  561.             }
  562.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_out']))
  563.             {
  564.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_out_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['dyn_search_out'];
  565.             }
  566.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_dyn_search']))
  567.             {
  568.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_dyn_search_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['cond_dyn_search'];
  569.             }
  570.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['Grid_search']))
  571.             {
  572.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['Grid_search_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['Grid_search'];
  573.             }
  574.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['grid_pesq']))
  575.             {
  576.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['grid_pesq_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['grid_pesq'];
  577.             }
  578.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_grid']))
  579.             {
  580.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_grid_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_grid'];
  581.             }
  582.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_ant']))
  583.             {
  584.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_ant_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_ant'];
  585.             }
  586.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_desc']))
  587.             {
  588.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_desc_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_desc'];
  589.             }
  590.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_cmp']))
  591.             {
  592.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_cmp_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_cmp'];
  593.             }
  594.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_order']))
  595.             {
  596.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_order_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_order'];
  597.             }
  598.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_display']))
  599.             {
  600.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_display_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['summarizing_fields_display'];
  601.             }
  602.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral']))
  603.             {
  604.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['tot_geral'];
  605.             }
  606.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_group_by']))
  607.             {
  608.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_group_by_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_group_by'];
  609.             }
  610.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_x_axys']))
  611.             {
  612.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_x_axys_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_x_axys'];
  613.             }
  614.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_y_axys']))
  615.             {
  616.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_y_axys_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_y_axys'];
  617.             }
  618.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_fill']))
  619.             {
  620.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_fill_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_fill'];
  621.             }
  622.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order']))
  623.             {
  624.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order'];
  625.             }
  626.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_col']))
  627.             {
  628.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_col_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_col'];
  629.             }
  630.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_level']))
  631.             {
  632.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_level_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_level'];
  633.             }
  634.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_sort']))
  635.             {
  636.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_sort_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_order_sort'];
  637.             }
  638.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_tabular']))
  639.             {
  640.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_tabular_SV'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['pivot_tabular'];
  641.             }
  642.             $_SESSION['sc_session'][$this->sc_init]['grid_new']['prim_save_grid'] = false;
  643.         }

  644.         $this->Sel_clear_conf_grid();
  645.         if(!isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['path_grid_sv_list'][ $NM_arq_save ])) return;
  646.         $NM_arq_save $_SESSION['sc_session'][$this->sc_init]['grid_new']['path_grid_sv_list'][ $NM_arq_save ];
  647.         if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($NM_arq_save))
  648.         {
  649.             $NM_arq_save NM_conv_charset($NM_arq_save$_SESSION['scriptcase']['charset'], "UTF-8");
  650.         }
  651.         $NM_patch $this->path_grid_sv "/" $NM_arq_save;
  652.         if (!is_file($NM_patch))
  653.         {
  654.             $NM_arq_save sc_convert_encoding($NM_arq_save"UTF-8"$_SESSION['scriptcase']['charset']);
  655.             $NM_patch $this->path_grid_sv "/" $NM_arq_save;
  656.         }
  657.         if (is_file($NM_patch))
  658.         {
  659.             $NM_arq_save file($NM_patch);
  660.             foreach ($NM_arq_save as $ind => $cada_lin_save)
  661.             {
  662.                 if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  663.                 {
  664.                     $cada_lin_save NM_conv_charset($cada_lin_save$_SESSION['scriptcase']['charset'], "UTF-8");
  665.                 }
  666.                 $dados explode("@NMF@"$cada_lin_save);
  667.                 if ($dados[1] == "SC_Save_Name")
  668.                 {
  669.                 }
  670.                 elseif ($dados[0] == "arr")
  671.                 {
  672.                     $_SESSION['sc_session'][$this->sc_init]['grid_new'][$dados[1]] = unserialize($dados[2]);
  673.                 }
  674.                 else
  675.                 {
  676.                     $_SESSION['sc_session'][$this->sc_init]['grid_new'][$dados[1]] = $dados[2];
  677.                 }
  678.             }
  679.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order']))
  680.             {
  681.                 foreach ($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'] as $ind => $dados)
  682.                 {
  683.                     if (!in_array($dados$_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_SV']))
  684.                     {
  685.                         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'][$ind]);
  686.                     }
  687.                 }
  688.             }
  689.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig']))
  690.             {
  691.                 foreach ($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig'] as $ind => $dados)
  692.                 {
  693.                     if (!in_array($dados$_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig_SV']))
  694.                     {
  695.                         unset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig'][$ind]);
  696.                     }
  697.                 }
  698.             }
  699.             if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby']) && !isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_All_Groupby'][$_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby']]))
  700.             {
  701.                 $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Ind_Groupby_SV'];
  702.                 if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp']))
  703.                 {
  704.                     $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_cmp_SV'];
  705.                 }
  706.                 if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql']))
  707.                 {
  708.                     $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['SC_Gb_Free_sql_SV'];
  709.                 }
  710.                 if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra']))
  711.                 {
  712.                     $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra']   = $_SESSION['sc_session'][$this->sc_init]['grid_new']['ordem_quebra_SV'];
  713.                 }
  714.             }
  715.         }
  716.         $this->Sel_return_apl();
  717.     }

  718.     function Sel_delete_conf_grid($NM_grid_del)
  719.     {
  720.         if(!isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['path_grid_sv_list'][ $NM_grid_del ])) return;
  721.         $NM_patch $this->path_grid_sv "/" $_SESSION['sc_session'][$this->sc_init]['grid_new']['path_grid_sv_list'][ $NM_grid_del ];
  722.         if (!is_file($NM_patch))
  723.         {
  724.             $NM_grid_del sc_convert_encoding($NM_grid_del"UTF-8");
  725.             $NM_patch $this->path_grid_sv "/" $NM_grid_del;
  726.         }
  727.         if (is_file($NM_patch))
  728.         {
  729.             unlink($NM_patch);
  730.         }
  731.     }

  732.     function Save_processa_form()
  733.     {
  734.          if ($this->proc_ajax)
  735.          {
  736.              ob_start();
  737.          }
  738.          $STR_lang    = (isset($_SESSION['scriptcase']['str_lang']) && !empty($_SESSION['scriptcase']['str_lang'])) ? $_SESSION['scriptcase']['str_lang'] : "en_us";
  739.          $NM_arq_lang "../_lib/lang/" $STR_lang ".lang.php";
  740.          $this->Nm_lang = array();
  741.          if (is_file($NM_arq_lang))
  742.          {
  743.              include_once($NM_arq_lang);
  744.          }
  745.          $_SESSION['scriptcase']['charset']  = (isset($this->Nm_lang['Nm_charset']) && !empty($this->Nm_lang['Nm_charset'])) ? $this->Nm_lang['Nm_charset'] : "UTF-8";
  746.          foreach ($this->Nm_lang as $ind => $dados)
  747.          {
  748.             if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($ind))
  749.             {
  750.                 $ind sc_convert_encoding($ind$_SESSION['scriptcase']['charset'], "UTF-8");
  751.                 $this->Nm_lang[$ind] = $dados;
  752.             }
  753.             if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($dados))
  754.             {
  755.                 $this->Nm_lang[$ind] = sc_convert_encoding($dados$_SESSION['scriptcase']['charset'], "UTF-8");
  756.             }
  757.          }
  758.          $str_schema_all = (isset($_SESSION['scriptcase']['str_schema_all']) && !empty($_SESSION['scriptcase']['str_schema_all'])) ? $_SESSION['scriptcase']['str_schema_all'] : "Sc9_Midnight/Sc9_Midnight";
  759.          include("../_lib/css/" $str_schema_all "_grid.php");
  760.          $str_toolbar_separator     trim($str_toolbar_separator);
  761.          $Str_btn_grid trim($str_button) . "/" trim($str_button) . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".php";
  762.          include("../_lib/buttons/" $Str_btn_grid);
  763.          if (!function_exists("nmButtonOutput"))
  764.          {
  765.              include_once("../_lib/lib/php/nm_gp_config_btn.php");
  766.          }
  767.          $this->gera_array_grid_save();
  768.    if (!$this->embbed)
  769.    {
  770. ?>
  771. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  772.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  773.       <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  774.       <HEAD>
  775.        <TITLE><?php echo $this->Nm_lang['lang_othr_grid_title'?> </TITLE>
  776.        <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  777. <?php
  778. if ($_SESSION['scriptcase']['proc_mobile'])
  779. {
  780. ?>
  781.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  782. <?php
  783. }
  784. ?>
  785.        <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  786.        <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  787.        <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  788.        <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  789.        <META http-equiv="Pragma" content="no-cache"/>
  790.        <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  791.        <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" /> 
  792.        <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" /> 
  793.        <?php
  794.        if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  795.        {
  796.        ?>
  797.           <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts'?>" />
  798.        <?php
  799.        }
  800.        ?>
  801.        <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" /> 
  802.        <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" /> 
  803.       </HEAD>
  804.       <BODY class="scGridPage" style="margin: 0px; overflow-x: hidden">
  805.       <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  806.       <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>
  807. <?php
  808.    }
  809. ?>
  810. <script language="javascript"> 
  811.  //-------------------------------------
  812.  function nm_save_grid()
  813.  {
  814.      if (document.Fsave.nmgp_save_name.value == '')
  815.      {
  816.         return;
  817.      }
  818.      parm  = document.Fsave.nmgp_save_option.value + '*NM@';
  819.      parm += document.Fsave.nmgp_save_name.value + '*NM@';
  820.      ajax_control('save_conf_grid', parm);
  821.  }
  822.  function nm_select_grid(str_path_save, str_display)
  823.  {
  824.      $('#id_save_used').html(': ' + str_display);
  825.      ajax_control('select_conf_grid', str_path_save);
  826.  }
  827.  function nm_new_grid()
  828.  {
  829.      document.getElementById('id_btn_edit').style.display = 'none';
  830.      document.getElementById('id_btn_save').style.display = '';
  831.      document.getElementById('Edit_grid').style.display = 'none';
  832.      document.getElementById('Salvar_grid').style.display = '';
  833.      ajusta_window();
  834.      document.Fsave.nmgp_save_name.focus();
  835.  }
  836.  function nm_cancel_new_grid()
  837.  {
  838.      document.getElementById('id_btn_edit').style.display = '';
  839.      document.getElementById('id_btn_save').style.display = 'none';
  840.      document.getElementById('Edit_grid').style.display = '';
  841.      document.getElementById('Salvar_grid').style.display = 'none';
  842.      ajusta_window();
  843.  }
  844.  function nm_del_grid(str_path_save)
  845.  {
  846.          ajax_control('delete_conf_grid', str_path_save);
  847.  }
  848. function ajax_control(opc, parm)
  849. {
  850.     if(opc == 'default' && parm == '')
  851.     {
  852.         $('#id_save_used').html('');
  853.     }
  854.     $.ajax({
  855.       type: "POST",
  856.       url: "grid_new_save_grid.php",
  857.       data: "ajax_ctrl=proc_ajax&script_case_init=" + document.Fsave.script_case_init.value + "&script_case_session=" + document.Fsave.script_case_session.value + "&path_img=" + document.Fsave.path_img.value + "&path_btn=" + document.Fsave.path_btn.value + "&Fsave_ok=" + opc  + "&parm=" + parm
  858.     })
  859.      .done(function(jsonReturn) {
  860.         var i, oResp;
  861.         Tst_integrid = jsonReturn.trim();
  862.         if ("{" != Tst_integrid.substr(0, 1)) {
  863.             alert (jsonReturn);
  864.             return;
  865.         }
  866.         eval("oResp = " + jsonReturn);
  867.         if (oResp["setHtml"]) {
  868.           for (i = 0; i < oResp["setHtml"].length; i++) {
  869.                $("#" + oResp["setHtml"][i]["field"]).html(oResp["setHtml"][i]["value"]);
  870.           }
  871.         }
  872.         if (oResp["setDisplay"]) {
  873.           for (i = 0; i < oResp["setDisplay"].length; i++) {
  874.                $("#" + oResp["setDisplay"][i]["field"]).css("display", oResp["setDisplay"][i]["value"]);
  875.           }
  876.         }
  877.         if (oResp["exit"]) {
  878. <?php
  879.    if (!$this->embbed)
  880.    {
  881. ?>
  882.             self.parent.tb_remove(); 
  883. <?php
  884.    }
  885.    $sParent $this->embbed '' 'parent.';
  886.    if ($this->sc_origem == "cons")
  887.    {
  888.    echo $sParent "nm_gp_submit_ajax('inicio', 'save_grid')"
  889.    }
  890.    else
  891.    {
  892.        echo $sParent "nm_gp_move('resumo', '0');";
  893.    }
  894. ?>
  895.         }
  896.         if (opc == 'save_conf_grid')
  897.         {
  898.             document.getElementById('input_save_name').value = '';
  899.             nm_cancel_new_grid();
  900.         }
  901.         ajusta_window();
  902.     });
  903. }
  904.  </script>
  905.       <FORM name="Fsave" method="POST">
  906.         <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->sc_init); ?>"> 
  907.         <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input($this->session); ?>"> 
  908.         <INPUT type="hidden" name="path_img" value="<?php echo NM_encode_input($this->path_img); ?>"> 
  909.         <INPUT type="hidden" name="path_btn" value="<?php echo NM_encode_input($this->path_btn); ?>"> 
  910.         <INPUT type="hidden" name="script_origem" value="<?php echo NM_encode_input($this->sc_origem); ?>"> 
  911.         <INPUT type="hidden" name="Fsave_ok" value="OK"> 
  912.      <br />
  913. <?php
  914. if ($this->embbed)
  915. {
  916.     echo "<div class='scAppDivMoldura'>";
  917.     echo "<table id=\"main_table\" style=\"width: 100%\" cellspacing=0 cellpadding=0>";
  918. }
  919. else
  920. {
  921.     echo "<table id=\"main_table\" align=\"center\">";
  922.     ?>
  923.     <tr>
  924.     <td>
  925.     <div class="scGridBorder">
  926.     <table width='100%' cellspacing=0 cellpadding=0>
  927. <?php
  928. }
  929. ?>
  930.  <tr>
  931.   <td class="<?php echo ($this->embbed)? 'scAppDivHeader scAppDivHeaderText':'scGridLabelVert'?>">
  932.    <?php echo $this->Nm_lang['lang_btns_gridsave_hint']; ?><span id='id_save_used'></span>
  933.   </td>
  934.  </tr>
  935.  <tr>
  936.   <td class="<?php echo ($this->embbed)? 'scAppDivContent scAppDivContentText':'scGridTabelaTd'?>">
  937.    <table class="<?php echo ($this->embbed)? '':'scGridTabela'?>" style="border-width: 0; border-collapse: collapse; width:100%;" cellspacing=0 cellpadding=0>
  938.     <tr class="<?php echo ($this->embbed)? '':'scGridFieldOddVert'?>">
  939.      <td style="vertical-align: top">
  940.      <table cellspacing=0 cellpadding=0 width='100%'>
  941.       <tr id="Salvar_grid" style="display:none" ><td align="center">
  942.         <table style="border-width: 0px; border-collapse: collapse" width="100%">
  943.          <tr>
  944.           <td>
  945.               <?php echo $this->Nm_lang['lang_othr_nivel']; ?>
  946.           </td>
  947.           <td style="padding: 0px" valign="top">
  948.            <SELECT class="<?php echo ($this->embbed)? 'scAppDivToolbarInput':'css_toolbar_obj'?>" id="id_save_option" name="nmgp_save_option" size="1">
  949.             <option value=""></option>
  950.             <option value="publico"><?php echo "" $this->Nm_lang['lang_srch_public'] . "" ?></option>
  951.            </SELECT>
  952.            <BR>
  953.         </tr>
  954.         <tr>
  955.           <td>
  956.               <?php echo $this->Nm_lang['lang_othr_nome']; ?>
  957.           </td>
  958.           <td>
  959.            <input id="input_save_name" class="<?php echo ($this->embbed)? 'scAppDivToolbarInput':'css_toolbar_obj'?>" type="text" name="nmgp_save_name" value="">
  960.           </td>
  961.          </tr>
  962.         </table>
  963.        </TD>
  964.       </tr>
  965.          <tr id="Edit_grid"><td align="center">
  966.      <span id="select_recup">
  967. <?php
  968.          if ($this->proc_ajax)
  969.          {
  970.              ob_end_clean();
  971.              ob_start();
  972.          }
  973. ?>
  974.          <table cellspacing=2 cellpadding=4 width='100%'>
  975.          <?php
  976.          foreach ($this->NM_grid_save as $level => $arr_level)
  977.          {
  978.              ?>
  979.              <tr>
  980.                  <td colspan='3'>
  981.                             <?php echo $level?>
  982.                  </td>
  983.              </tr>
  984.              <?php
  985.             foreach ($arr_level as $save => $save_path)
  986.             {
  987.              ?>
  988.              <tr>
  989.                  <td width='1'>&nbsp;</td>
  990.                  <td>
  991.                             <?php echo $save?>
  992.                  </td>
  993.                  <td width='50' nowrap>
  994.                          &nbsp;
  995.                  </td>
  996.                  <td width='200' nowrap>
  997.                          <a href="#" onclick="nm_select_grid('<?php echo NM_encode_input($save_path); ?>', '<?php echo $level?> => <?php echo $save?>')" class="scGridPageLink"><?php echo $this->Nm_lang['lang_btns_apply']; ?></a>
  998.                          &nbsp;
  999.                          <img src='<?php echo $this->path_img?>/<?php echo $str_toolbar_separator?>' border='0'  align='absmiddle'>
  1000.                          &nbsp;
  1001.                          <a href="#" onclick="nm_del_grid('<?php echo NM_encode_input($save_path); ?>')" class="scGridPageLink"><?php echo $this->Nm_lang['lang_btns_dele']; ?></a>
  1002.                  </td>
  1003.              </tr>
  1004.              <?php
  1005.             }
  1006.          }
  1007.          ?>
  1008.          </table>
  1009. <?php
  1010.          if ($this->proc_ajax)
  1011.          {
  1012.              $this->ajax_return['setHtml'][] = array('field' => 'select_recup''value' => ob_get_contents());
  1013.              $this->ajax_return['setDisplay'][] = array('field' => 'id_btn_Brestore''value' => (!$_SESSION['sc_session'][$this->sc_init]['grid_new']['prim_save_grid'])?'':'none');
  1014.          }
  1015. ?>
  1016.   &nbsp;&nbsp;&nbsp
  1017.      </span>
  1018.              </td>
  1019.          </tr>
  1020.          <tr><td class="<?php echo ($this->embbed)? 'scAppDivToolbar':'scGridToolbar'?>">
  1021.                <div id="id_btn_edit">
  1022.           <?php echo nmButtonOutput($this->arr_buttons"bnovo_appdiv""nm_new_grid();""nm_new_grid();""Ativa_save""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  1023. ?>
  1024.   &nbsp;&nbsp;&nbsp;&nbsp;
  1025. <span id='id_btn_Brestore' style="display:<?php echo (!$_SESSION['sc_session'][$this->sc_init]['grid_new']['prim_save_grid'])?'':'none' ?>">
  1026.          <?php echo nmButtonOutput($this->arr_buttons"brestore_appdiv""ajax_control('default', '')""ajax_control('default', '')""Brestore""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  1027. ?>
  1028.   &nbsp;&nbsp;&nbsp
  1029. </span>
  1030. <?php
  1031.    if (!$this->embbed)
  1032.    {
  1033. ?>
  1034.    <?php echo nmButtonOutput($this->arr_buttons"bsair_appdiv""self.parent.tb_remove()""self.parent.tb_remove()""Bsair""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  1035. ?>
  1036. <?php
  1037.    }
  1038.    else
  1039.    {
  1040. ?>
  1041.    <?php echo nmButtonOutput($this->arr_buttons"bsair_appdiv""scBtnSaveGridHide('" $this->tbar_pos "');buttonunselectedSG();""scBtnSaveGridHide('" $this->tbar_pos "');buttonunselectedSG();""Bsair""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  1042. ?>
  1043. <?php
  1044.    }
  1045. ?>
  1046.                </div>
  1047.                <div id="id_btn_save" style="display:none">
  1048.            <?php echo nmButtonOutput($this->arr_buttons"bsalvar_appdiv""nm_save_grid()""nm_save_grid()""Save_frm""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  1049. ?>
  1050.            <?php echo nmButtonOutput($this->arr_buttons"bcancelar_appdiv""nm_cancel_new_grid()""nm_cancel_new_grid()""Cancel_frm""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  1051. ?>
  1052.   &nbsp;&nbsp;&nbsp
  1053.                </div>
  1054.              </td>
  1055.          </tr>
  1056.    </table>
  1057.    </td></tr></table>
  1058.   </td>
  1059.   </tr>
  1060.  </table>
  1061.  </div>
  1062.  </td>
  1063.  </tr>
  1064.  </table>
  1065. </FORM>

  1066. <script language="javascript"> 
  1067. var bFixed = false;

  1068. function ajusta_window()
  1069. {
  1070. <?php
  1071.    if (!$this->embbed)
  1072.    {
  1073. ?>
  1074.   var mt = $(document.getElementById("main_table"));
  1075.   if (0 == mt.width() || 0 == mt.height())
  1076.   {
  1077.     setTimeout("ajusta_window()", 50);
  1078.     return;
  1079.   }
  1080.   else if(!bFixed)
  1081.   {
  1082.     bFixed = true;
  1083.     if (navigator.userAgent.indexOf("Chrome/") > 0)
  1084.     {
  1085.       self.parent.tb_resize(mt.height() + 40, mt.width() + 40);
  1086.       setTimeout("ajusta_window()", 50);
  1087.       return;
  1088.     }
  1089.   }
  1090.   self.parent.tb_resize(mt.height() + 40, mt.width() + 40);
  1091. <?php
  1092.    }
  1093. ?>
  1094. }
  1095. $( document ).ready(function() {
  1096.   <?php
  1097.   if (empty($this->NM_grid_save))
  1098.   {
  1099.       ?>
  1100.       nm_new_grid();
  1101.       <?php
  1102.   }
  1103.   ?>
  1104.   buttonSelectedSG();
  1105.   ajusta_window();
  1106. });
  1107. </script>
  1108. <script>
  1109. function buttonSelectedSG() {
  1110.    $("#save_grid_top").addClass("selected");
  1111.    $("#save_grid_bottom").addClass("selected");
  1112. }
  1113. function buttonunselectedSG() {
  1114.    $("#save_grid_top").removeClass("selected");
  1115.    $("#save_grid_bottom").removeClass("selected");
  1116. }
  1117.     buttonSelectedSG();
  1118.     ajusta_window()
  1119. </script>
  1120. <?php
  1121.    if (!$this->embbed)
  1122.    {
  1123. ?>
  1124. </BODY>
  1125. </HTML>
  1126. <?php
  1127.   }
  1128.    if ($this->proc_ajax)
  1129.    {
  1130.        ob_end_clean();
  1131.        $oJson = new Services_JSON();
  1132.        echo $oJson->encode($this->ajax_return);
  1133.        exit;
  1134.    }

  1135. }
  1136.    function gera_array_grid_save()
  1137.    {
  1138.        $this->NM_grid_save = array();
  1139.        $_SESSION['sc_session'][$this->sc_init]['grid_new']['path_grid_sv_list'] = array();
  1140.        $NM_patch   "Projeto7/grid_new";
  1141.        if (is_dir($this->path_grid_sv $NM_patch))
  1142.        {
  1143.            $NM_dir = @opendir($this->path_grid_sv $NM_patch);
  1144.            while (FALSE !== ($NM_arq = @readdir($NM_dir)))
  1145.            {
  1146.              if (@is_file($this->path_grid_sv $NM_patch "/" $NM_arq))
  1147.              {
  1148.                  $NM_sv_grid file($this->path_grid_sv $NM_patch "/" $NM_arq);
  1149.                  foreach ($NM_sv_grid as $ind => $cada_lin_save)
  1150.                  {
  1151.                      $dados explode("@NMF@"$cada_lin_save);
  1152.                      if ($dados[1] == "SC_Save_Name")
  1153.                      {
  1154.                          $Name_save $dados[2];
  1155.                          break;
  1156.                      }
  1157.                  }
  1158.                  if ($_SESSION['scriptcase']['charset'] != "UTF-8" && !$this->proc_ajax)
  1159.                  {
  1160.                      $Name_save sc_convert_encoding($Name_save$_SESSION['scriptcase']['charset'], "UTF-8");
  1161.                  }
  1162.                  if (!empty($Name_save))
  1163.                  {
  1164.                      $str_level "" $this->Nm_lang['lang_srch_public'] . "";
  1165.                      $this->NM_grid_save[$str_level][$Name_save] = md5($NM_patch "/" $NM_arq);
  1166.                      $_SESSION['sc_session'][$this->sc_init]['grid_new']['path_grid_sv_list'][md5($NM_patch "/" $NM_arq)] = $NM_patch "/" $NM_arq;
  1167.                  }
  1168.              }
  1169.            }
  1170.        }
  1171.    }
  1172. }
Return
grid_new_sel_campos.php
  1. <?php
  2.    if(!isset($bol_sel_campos_include))
  3.    {
  4.        $bol_sel_campos_include false;
  5.    }
  6.    if(!$bol_sel_campos_include)
  7.    {
  8.      include_once('grid_new_session.php');
  9.      session_start();
  10.      $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  11.      //check tmp
  12.      if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  13.      {
  14.        $str_path_apl_url $_SERVER['PHP_SELF'];
  15.        $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  16.        $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  17.        $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  18.        /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  19.      }
  20.      if (!isset($_SESSION['sc_session']))
  21.      {
  22.        $NM_dir_atual getcwd();
  23.        if (empty($NM_dir_atual))
  24.        {
  25.            $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  26.            $str_path_sys  str_replace("\\"'/'$str_path_sys);
  27.        }
  28.        else
  29.        {
  30.            $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  31.            $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  32.        }
  33.        $str_path_web    $_SERVER['PHP_SELF'];
  34.        $str_path_web    str_replace("\\"'/'$str_path_web);
  35.        $str_path_web    str_replace('//''/'$str_path_web);
  36.        $root            substr($str_path_sys0, -strlen($str_path_web));
  37.        if (is_file($root $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/sc_apl_default_Projeto7.txt"))
  38.        {
  39. ?>
  40.            <script language="javascript">
  41.             nm_move();
  42.            </script>
  43. <?php
  44.            exit;
  45.        }
  46.      }
  47.      if (!function_exists("NM_is_utf8"))
  48.      {
  49.         include_once("../_lib/lib/php/nm_utf8.php");
  50.      }
  51.       $Sel_Cmp = new grid_new_sel_cmp($bol_sel_campos_include); 
  52.       $Sel_Cmp->Sel_cmp_init();
  53.       $Sel_Cmp->Sel_cmp_init_fields();
  54.       $Sel_Cmp->Sel_cmp_process();
  55.      
  56.   }
  57. class grid_new_sel_cmp
  58. {
  59. function Sel_cmp_init($bol_sel_campos_include false$sc_init ''$path_img ''$path_btn ''$path_fields '',$embbed true$tbar_pos '')
  60. {
  61.    $this->proc_ajax false;
  62.    if (isset($_POST['script_case_init']))
  63.    {
  64.        $this->sc_init      filter_input(INPUT_POST'script_case_init'FILTER_SANITIZE_NUMBER_INT);
  65.        $this->path_img     filter_input(INPUT_POST'path_img'FILTER_SANITIZE_STRING);
  66.        $this->path_btn     filter_input(INPUT_POST'path_btn'FILTER_SANITIZE_STRING);
  67.        $this->path_fields  filter_input(INPUT_POST'path_fields'FILTER_SANITIZE_STRING);
  68.        $this->embbed       = isset($_POST['embbed_groupby']) && 'Y' == $_POST['embbed_groupby'];
  69.        $this->tbar_pos     filter_input(INPUT_POST'toolbar_pos'FILTER_SANITIZE_SPECIAL_CHARS);
  70.    }
  71.    elseif (isset($_GET['script_case_init']))
  72.    {
  73.        $this->sc_init      filter_input(INPUT_GET'script_case_init'FILTER_SANITIZE_NUMBER_INT);
  74.        $this->path_img     filter_input(INPUT_GET'path_img'FILTER_SANITIZE_STRING);
  75.        $this->path_btn     filter_input(INPUT_GET'path_btn'FILTER_SANITIZE_STRING);
  76.        $this->path_fields  filter_input(INPUT_GET'path_fields'FILTER_SANITIZE_STRING);
  77.        $this->embbed       = isset($_GET['embbed_groupby']) && 'Y' == $_GET['embbed_groupby'];
  78.        $this->tbar_pos     filter_input(INPUT_GET'toolbar_pos'FILTER_SANITIZE_SPECIAL_CHARS);
  79.    }
  80.    else
  81.    {
  82.        $this->sc_init     $sc_init;
  83.        $this->path_img    $path_img;
  84.        $this->path_btn    $path_btn;
  85.        $this->path_fields $path_fields;
  86.        $this->embbed      $embbed;
  87.        $this->tbar_pos    $tbar_pos;
  88.    }
  89.    $this->bol_sel_campos_include    $bol_sel_campos_include;
  90.    if(isset($_REQUEST['embbed_export']) && $_REQUEST['embbed_export'] == 'Y')
  91.    {
  92.        $this->bol_sel_campos_include true;
  93.    }
  94.    if (isset($_POST['ajax_ctrl']) && $_POST['ajax_ctrl'] == "proc_ajax")
  95.    {
  96.        $this->proc_ajax true;
  97.    }
  98.    $this->ajax_return = array();
  99.    $this->campos_sel  = isset($_POST['campos_sel']) ? $_POST['campos_sel'] : array();
  100.    $this->restore     = isset($_POST['restore'])    ? true                  false;
  101.    if ($this->restore && !class_exists('Services_JSON'))
  102.    {
  103.        include_once("grid_new_json.php");
  104.    }
  105.    $this->Arr_result = array();
  106. }
  107. function Sel_cmp_process()
  108. {
  109.    if (isset($_POST['fsel_ok']) && $_POST['fsel_ok'] == "OK" && !empty($this->campos_sel) && !$this->restore)
  110.    {
  111.        $this->Sel_processa_out();
  112.    }
  113.    else
  114.    {
  115.        if ($this->embbed)
  116.        {
  117.            ob_start();
  118.            $this->Sel_processa_form();
  119.            $Temp ob_get_clean();
  120.            echo NM_charset_to_utf8($Temp);
  121.        }
  122.        else
  123.        {
  124.            $this->Sel_processa_form();
  125.        }
  126.    }
  127.    exit;}
  128.    function Sel_css($bol_include_all false)
  129.    {
  130.       if($bol_include_all)
  131.       {
  132.          ?>
  133.          <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup'?>" />
  134.          <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_dir'?>" />
  135.          <?php
  136.       }
  137.       ?>
  138.       <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div'?>" />
  139.       <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $_SESSION['scriptcase']['css_popup_div_dir'?>" />
  140.       <?php
  141.       if($bol_include_all)
  142.       {
  143.          ?>
  144.          <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $_SESSION['scriptcase']['css_btn_popup'?>" />
  145.          <?php
  146.           if(isset($_SESSION['scriptcase']['str_google_fonts']) && !empty($_SESSION['scriptcase']['str_google_fonts']))
  147.           {
  148.             ?>
  149.             <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['scriptcase']['str_google_fonts']; ?>" />
  150.             <?php
  151.           }
  152.       }
  153.    }

  154.    function Sel_cmp_init_fields()
  155.    {
  156.       global $tab_ger_campos$tab_blk_campos;

  157.       $tab_ger_campos = array();
  158.       $tab_blk_campos = array();

  159.             $tab_ger_campos['proprietarios_idproprietario'] = "on";
  160.       $tab_ger_campos['proprietarios_nome'] = "on";
  161.       $tab_ger_campos['proprietarios_sexo'] = "on";
  162.       $tab_ger_campos['proprietarios_cpf'] = "on";
  163.       $tab_ger_campos['proprietarios_telefone'] = "on";
  164.       $tab_ger_campos['veiculos_idveiculos'] = "on";
  165.       $tab_blk_campos[] = "veiculos_idveiculos";
  166.       $tab_ger_campos['veiculos_anomodelo'] = "on";
  167.       $tab_blk_campos[] = "veiculos_anomodelo";
  168.       $tab_ger_campos['veiculos_placa'] = "on";
  169.       $tab_blk_campos[] = "veiculos_placa";
  170.       $tab_ger_campos['proprietarios_endereco'] = "on";


  171.       if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']))
  172.       {
  173.           foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display'] as $NM_cada_field => $NM_cada_opc)
  174.           {
  175.               if ($NM_cada_opc == "off")
  176.               {
  177.                  $tab_ger_campos[$NM_cada_field] = "none";
  178.               }
  179.           }
  180.       }

  181.       if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['php_cmp_sel']) && !empty($_SESSION['sc_session'][$this->sc_init]['grid_new']['php_cmp_sel']))
  182.       {
  183.           foreach ($_SESSION['sc_session'][$this->sc_init]['grid_new']['php_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  184.           {
  185.               if ($NM_cada_opc == "off")
  186.               {
  187.                  $tab_ger_campos[$NM_cada_field] = "none";
  188.               }
  189.           }
  190.       }

  191.       if ($this->restore)
  192.       {
  193.           if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel_orig']) && !empty($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel_orig']))
  194.           {
  195.               foreach ($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel_orig'] as $NM_cada_field => $NM_cada_opc)
  196.               {
  197.                   $tab_ger_campos[$NM_cada_field] = $NM_cada_opc;
  198.               }
  199.           }
  200.       }
  201.       else
  202.       {
  203.           if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel']) && !empty($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel']))
  204.           {
  205.               foreach ($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  206.               {
  207.                   $tab_ger_campos[$NM_cada_field] = $NM_cada_opc;
  208.               }
  209.           }
  210.       }
  211.    }
  212. function Sel_processa_out()
  213. {
  214.    global $tab_ger_campos;
  215.    $arr_temp = array();
  216.    if (!isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel']))
  217.    {
  218.        $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel'] = array();
  219.    }
  220.    if($this->bol_sel_campos_include)
  221.    {
  222.        $_SESSION['sc_session'][$this->sc_init]['grid_new']['export_sel_columns']['field_order'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'];
  223.        $_SESSION['sc_session'][$this->sc_init]['grid_new']['export_sel_columns']['usr_cmp_sel'] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel'];
  224.    }
  225.    $arr_order $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'];
  226.    $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'] = array();
  227.    $campos_sel explode("@?@"$this->campos_sel);
  228.    foreach ($campos_sel as $campo_order)
  229.    {
  230.        if (isset($tab_ger_campos[$campo_order]))
  231.        {
  232.            $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'][] = $campo_order;
  233.        }
  234.    }
  235.    foreach ($arr_order as $campo_order)
  236.    {
  237.        if (!in_array($campo_order$_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order']))
  238.        {
  239.            $_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'][] = $campo_order;
  240.        }
  241.    }
  242.    foreach ($tab_ger_campos as $campo_cons => $opc)
  243.    {
  244.        if (!in_array($campo_cons$campos_sel) && $opc != "none")
  245.        {
  246.            $arr_temp[$campo_cons] = "off";
  247.        }
  248.    }
  249.    $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel'] = $arr_temp;
  250.    if($this->bol_sel_campos_include)
  251.    {
  252.        return;
  253.    }
  254. ?>
  255.     <script language="javascript"> 
  256. <?php
  257.    if (!$this->embbed)
  258.    {
  259. ?>
  260.       self.parent.tb_remove(); 
  261. <?php
  262.    }
  263. ?>
  264. <?php
  265.    $sParent $this->embbed '' 'parent.';
  266.    echo $sParent "nm_gp_submit_ajax('igual', '')"
  267. ?>
  268.    </script>
  269. <?php
  270. }
  271.    
  272.    function displayHtml($bol_css_all)
  273.    {
  274.       global $tab_ger_campos$tab_blk_campos;

  275.       $this->Sel_css($bol_css_all);

  276. ?>
  277. <script language="javascript" type="text/javascript">

  278. <?php
  279. if ($this->embbed)
  280. {
  281. ?>
  282.   function scSubmitSelCampos(sPos) {
  283.    scPackSelected();
  284.    if ($("#id_campos_sel_sel_campos").val() == "") {
  285.        restore_sel();
  286.        return;
  287.    }
  288. <?php
  289. if ($_SESSION['scriptcase']['proc_mobile']) {
  290. ?>
  291.    return new Promise(function(resolve, reject) {
  292. <?php
  293. }
  294. ?>
  295.    $.ajax({
  296.     type: "POST",
  297.     url: "grid_new_sel_campos.php",
  298.     data: {
  299.      script_case_init: $("#id_script_case_init_sel_campos").val(),
  300.      script_case_session: $("#id_script_case_session_sel_campos").val(),
  301.      path_img: $("#id_path_img_sel_campos").val(),
  302.      path_btn: $("#id_path_btn_sel_campos").val(),
  303.      path_fields: $("#id_path_fields_sel_campos").val(),
  304.      campos_sel: $("#id_campos_sel_sel_campos").val(),
  305.      fsel_ok: $("#id_fsel_ok_sel_campos").val(),
  306.      embbed_groupby: 'Y'
  307.     }
  308.    }).done(function(data) {
  309.     scBtnSelCamposHide(sPos);
  310.     buttonunselectedSF();
  311.     $("#sc_id_sel_campos_placeholder_" + sPos).find("td").html("");
  312.     var execString = data.toString().replace(/(\<.*?\>)/g, '');
  313.     eval(execString).then(function(){resolve()});
  314.    });
  315. <?php
  316. if ($_SESSION['scriptcase']['proc_mobile']) {
  317. ?>
  318.    });
  319. <?php
  320. }
  321. ?>
  322.   }
  323. <?php
  324. }

  325. if(!isset($bol_sel_campos_include) || !$bol_sel_campos_include)
  326. {
  327. ?>
  328. function scSubmitSelCamposAjaxExport(sPos) {
  329.    scPackSelected();

  330. <?php
  331. if ($_SESSION['scriptcase']['proc_mobile']) {
  332. ?>
  333.    return new Promise(function(resolve, reject) {
  334. <?php
  335. }
  336. ?>
  337.    $.ajax({
  338.     type: "POST",
  339.     url: "grid_new_sel_campos.php",
  340.     async: false,
  341.     data: {
  342.      script_case_init: $("#id_script_case_init_sel_campos").val(),
  343.      script_case_session: $("#id_script_case_session_sel_campos").val(),
  344.      path_img: $("#id_path_img_sel_campos").val(),
  345.      path_btn: $("#id_path_btn_sel_campos").val(),
  346.      path_fields: $("#id_path_fields_sel_campos").val(),
  347.      campos_sel: $("#id_campos_sel_sel_campos").val(),
  348.      fsel_ok: $("#id_fsel_ok_sel_campos").val(),
  349.      embbed_groupby: 'Y',
  350.      embbed_export: 'Y',
  351.     }
  352.    }).done(function(data) {
  353.     scSubmitSelCamposAjaxExportDone();
  354.    });
  355. <?php
  356. if ($_SESSION['scriptcase']['proc_mobile']) {
  357. ?>
  358.    });
  359. <?php
  360. }
  361. ?>
  362.   }
  363.   <?php
  364. }
  365. ?>

  366.  function submit_form_Fsel()
  367.  {
  368.      scPackSelected();
  369.      buttonunselectedSF();
  370.      document.Fsel_campos.submit();
  371.  }

  372.  function restore_sel() {
  373.      $.ajax({
  374.          type: 'POST',
  375.          url: "grid_new_sel_campos.php",
  376.          data: {
  377.             script_case_init: $("#id_script_case_init_sel_campos").val(),
  378.             script_case_session: $("#id_script_case_session_sel_campos").val(),
  379.             restore: 'ok',
  380.          }
  381.      })
  382.      .done(function(retcombos) {
  383.         eval("Combos = " + retcombos);
  384.         $("#sc_id_fldsel_available").html(Combos["fldsel_available"]);
  385.         $("#sc_id_fldsel_selected").html(Combos["fldsel_selected"]);
  386.         if (typeof(buttonDisable_sel) === 'function') buttonDisable_sel("Brestore_sel");
  387.         buttonEnable_sel("f_sel_sub_sel");
  388.      });
  389. }

  390. function display_btn_restore_sel() {
  391.      buttonEnable_sel("Brestore_sel");
  392.      buttonEnable_sel("f_sel_sub_sel");
  393. }

  394. function proc_btn_sel(btn, proc) {
  395.     if ($("#" + btn).prop("disabled") == true) {
  396.         return;
  397.     }
  398.     eval (proc);
  399. }

  400.  function scPackSelected()
  401.  {
  402.   var fieldList, fieldName, i, selectedFields = new Array;
  403.   fieldList = $("#sc_id_fldsel_selected").sortable("toArray");
  404.   for (i = 0; i < fieldList.length; i++)
  405.   {
  406.     fieldName = fieldList[i].substr(14);
  407.     selectedFields.push(fieldName);
  408.   }
  409.   $("#id_campos_sel_sel_campos").val( selectedFields.join("@?@") );
  410.  }

  411.  $(function() {
  412.   $( "#sc_id_fldsel_selected" ).sortable({
  413.     remove: function( event, ui ) {
  414.             if ($(ui.item).hasClass('scAppDivSelectFieldsDisabled')) {
  415.               return false;
  416.             }
  417.             display_btn_restore_sel();
  418.           } ,
  419.     change: function( event, ui ) {
  420.             display_btn_restore_sel();
  421.           },
  422.     receive: function( event, ui ) {
  423.             display_btn_restore_sel();
  424.           }
  425.   })

  426.   $(".sc_ui_litem").mouseover(function() {
  427.    $(this).css("cursor", "all-scroll");
  428.   });
  429.   $("#sc_id_fldsel_available").sortable({
  430.       connectWith: ".sc_ui_fldsel_selected",
  431.       placeholder: "scAppDivSelectFieldsPlaceholder",
  432.       update: function( event, ui ) {
  433.       if($('#sc_id_fldsel_selected').children('li').length < 1)
  434.       {
  435.         if (typeof(buttonDisable_sel) === 'function') buttonDisable_sel('f_sel_sub_sel');
  436.       }
  437.       else
  438.       {
  439.         if (typeof(buttonEnable_sel) === 'function') buttonEnable_sel('f_sel_sub_sel');
  440.       }
  441.      },
  442.   }).disableSelection();
  443.   $("#sc_id_fldsel_selected").sortable({
  444.    connectWith: ".sc_ui_fldsel_available",
  445.    placeholder: "scAppDivSelectFieldsPlaceholder",
  446.    update: function( event, ui ) {
  447.     if($('#sc_id_fldsel_selected').children('li').length < 1)
  448.     {
  449.       if (typeof(buttonDisable_sel) === 'function') buttonDisable_sel('f_sel_sub_sel');
  450.     }
  451.     else
  452.     {
  453.       if (typeof(buttonEnable_sel) === 'function') buttonEnable_sel('f_sel_sub_sel');
  454.     }
  455.    },
  456.   }).disableSelection();

  457.   if (typeof(buttonDisable_sel) === 'function') buttonDisable_sel('f_sel_sub_sel');
  458.   scUpdateListHeight();
  459.  });
  460.  function scUpdateListHeight() {
  461.   $("#sc_id_fldsel_available").css("min-height", "<?php echo sizeof($tab_ger_campos) * 27 ?>px");
  462.   $("#sc_id_fldsel_selected").css("min-height", "<?php echo sizeof($tab_ger_campos) * 27 ?>px");
  463.  }
  464. </script>

  465. <style type="text/css">
  466.  .sc_ui_sortable {
  467.   list-style-type: none;
  468.   margin: 0;
  469.   min-width: 225px;
  470.  }
  471.  .sc_ui_sortable li {
  472.   margin: 0 3px 3px 3px;
  473.   padding: 3px 3px 3px 15px;
  474.   min-height: 18px;
  475.  }
  476.  .sc_ui_sortable li span {
  477.   position: absolute;
  478.   margin-left: -1.3em;
  479.  }
  480. </style>

  481.   <INPUT type="hidden" name="script_case_init" id="id_script_case_init_sel_campos" value="<?php echo NM_encode_input($this->sc_init); ?>">
  482.   <INPUT type="hidden" name="script_case_session" id="id_script_case_session_sel_campos" value="<?php echo NM_encode_input(session_id()); ?>">
  483.   <INPUT type="hidden" name="path_img" id="id_path_img_sel_campos" value="<?php echo NM_encode_input($this->path_img); ?>">
  484.   <INPUT type="hidden" name="path_btn" id="id_path_btn_sel_campos" value="<?php echo NM_encode_input($this->path_btn); ?>">
  485.   <INPUT type="hidden" name="path_fields" id="id_path_fields_sel_campos" value="<?php echo NM_encode_input($this->path_fields); ?>">
  486.   <INPUT type="hidden" name="fsel_ok" id="id_fsel_ok_sel_campos" value="OK">
  487.   <input type="hidden" name="campos_sel" id="id_campos_sel_sel_campos" value="" />

  488.    <table class="<?php echo ($this->embbed)? '':'scGridTabela'?>" style="border-width: 0; border-collapse: collapse; width:100%;" cellspacing=0 cellpadding=0>
  489.       <tr class="<?php echo ($this->embbed)? '':'scGridFieldOddVert'?>">
  490.          <td style="vertical-align: top">
  491.             <table>
  492.                <tr>
  493.                   <td id="select_orig" style="vertical-align: top">
  494. <?php
  495.       if ($this->proc_ajax)
  496.       {
  497.           ob_end_clean();
  498.           ob_start();
  499.       }
  500. ?>
  501.                      <ul class="sc_ui_sort_groupby sc_ui_sortable sc_ui_fldsel_available scAppDivSelectFields" id="sc_id_fldsel_available">
  502. <?php
  503.    $prep_combo = array();
  504.    foreach ($tab_ger_campos as $NM_cada_field => $NM_cada_opc)
  505.    {
  506.        if ($NM_cada_opc != "none")
  507.        {
  508.            if ($NM_cada_opc != "on")
  509.            {
  510.                $prep_combo[strtolower($NM_cada_field)] = $_SESSION['sc_session'][$this->sc_init]['grid_new']['labels'][$NM_cada_field];
  511.            }
  512.        }
  513.    }
  514.    if ($this->restore)
  515.    {
  516.        ob_end_clean();
  517.        ob_start();
  518.    }
  519.    foreach ($prep_combo as $ind => $cada_field)
  520.    {
  521. ?>
  522.                         <li class="sc_ui_litem scAppDivSelectFieldsEnabled" id="sc_id_itemsel_<?php echo NM_encode_input($ind); ?>"><?php echo $cada_field?></li>
  523. <?php
  524.    }
  525.    if ($this->restore)
  526.    {
  527.        $this->Arr_result['fldsel_available'] = NM_charset_to_utf8(ob_get_clean());
  528.    }

  529. ?>
  530.                      </ul>
  531. <?php
  532.       if ($this->proc_ajax)
  533.       {
  534.           $this->ajax_return['setHtml'][] = array('field' => 'select_orig''value' => ob_get_contents());
  535.       }
  536. ?>
  537.                   </td>
  538.                   <td style="vertical-align: top" id="select_dest">
  539. <?php
  540.       if ($this->proc_ajax)
  541.       {
  542.           ob_end_clean();
  543.           ob_start();
  544.       }
  545. ?>

  546.                      <ul class="sc_ui_sort_groupby sc_ui_sortable sc_ui_fldsel_selected scAppDivSelectFields" id="sc_id_fldsel_selected">
  547. <?php
  548.    if ($this->restore)
  549.    {
  550.        ob_end_clean();
  551.        ob_start();
  552.    }
  553.    if ($this->restore && isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig']))
  554.    {
  555.        foreach ($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig'] as $NM_cada_field)
  556.        {
  557.            if ($tab_ger_campos[$NM_cada_field] == "on")
  558.            {
  559.                $str_class "scAppDivSelectFieldsDisabled";
  560.                if (!in_array($NM_cada_field$tab_blk_campos))
  561.                {
  562.                   $str_class "scAppDivSelectFieldsEnabled";
  563.                }
  564. ?>
  565.                         <li class="sc_ui_litem <?php echo $str_class?>" id="sc_id_itemsel_<?php echo NM_encode_input($NM_cada_field); ?>"><?php echo $_SESSION['sc_session'][$this->sc_init]['grid_new']['labels'][$NM_cada_field]; ?></li>
  566. <?php
  567.            }
  568.        }
  569.    }
  570.    if ($this->restore)
  571.    {
  572.        $this->Arr_result['fldsel_selected'] = NM_charset_to_utf8(ob_get_clean());
  573.        $oJson = new Services_JSON();
  574.        echo $oJson->encode($this->Arr_result);
  575.        exit;
  576.    }
  577.    if (!$this->restore && isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order']))
  578.    {
  579.        foreach ($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'] as $NM_cada_field)
  580.        {
  581.            if ($tab_ger_campos[$NM_cada_field] == "on")
  582.            {
  583.                $str_class "scAppDivSelectFieldsDisabled";
  584.                if (!in_array($NM_cada_field$tab_blk_campos))
  585.                {
  586.                   $str_class "scAppDivSelectFieldsEnabled";
  587.                }
  588. ?>
  589.                         <li class="sc_ui_litem <?php echo $str_class?>" id="sc_id_itemsel_<?php echo NM_encode_input($NM_cada_field); ?>"><?php echo $_SESSION['sc_session'][$this->sc_init]['grid_new']['labels'][$NM_cada_field]; ?></li>
  590. <?php
  591.            }
  592.        }
  593.    }


  594. ?>
  595.                      </ul>

  596. <?php
  597.       if ($this->proc_ajax)
  598.       {
  599.           $this->ajax_return['setHtml'][] = array('field' => 'select_dest''value' => ob_get_contents());
  600.       }
  601. ?>

  602.                   </td>
  603.                </tr>
  604.             </table>
  605.          </td>
  606.       </tr>
  607.    </table>

  608. <?php
  609.    }function Sel_processa_form()
  610. {
  611.    global $tab_ger_campos$tab_blk_campos;
  612.    if ($this->proc_ajax || $this->restore)
  613.    {
  614.        ob_start();
  615.    }
  616.    $size 10;
  617.    $STR_lang    = (isset($_SESSION['scriptcase']['str_lang']) && !empty($_SESSION['scriptcase']['str_lang'])) ? $_SESSION['scriptcase']['str_lang'] : "en_us";
  618.    $NM_arq_lang "../_lib/lang/" $STR_lang ".lang.php";
  619.    $this->Nm_lang = array();
  620.    if (is_file($NM_arq_lang))
  621.    {
  622.        include_once($NM_arq_lang);
  623.    }
  624.    $_SESSION['scriptcase']['charset']  = (isset($this->Nm_lang['Nm_charset']) && !empty($this->Nm_lang['Nm_charset'])) ? $this->Nm_lang['Nm_charset'] : "UTF-8";
  625.    foreach ($this->Nm_lang as $ind => $dados)
  626.    {
  627.       if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($ind))
  628.       {
  629.           $ind sc_convert_encoding($ind$_SESSION['scriptcase']['charset'], "UTF-8");
  630.           $this->Nm_lang[$ind] = $dados;
  631.       }
  632.       if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($dados))
  633.       {
  634.           $this->Nm_lang[$ind] = sc_convert_encoding($dados$_SESSION['scriptcase']['charset'], "UTF-8");
  635.       }
  636.    }
  637.    $str_schema_all = (isset($_SESSION['scriptcase']['str_schema_all']) && !empty($_SESSION['scriptcase']['str_schema_all'])) ? $_SESSION['scriptcase']['str_schema_all'] : "Sc9_Midnight/Sc9_Midnight";
  638.    include("../_lib/css/" $str_schema_all "_grid.php");
  639.    $Str_btn_grid trim($str_button) . "/" trim($str_button) . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".php";
  640.    include("../_lib/buttons/" $Str_btn_grid);
  641.    if (!function_exists("nmButtonOutput"))
  642.    {
  643.        include_once("../_lib/lib/php/nm_gp_config_btn.php");
  644.    }
  645.    if (!$this->embbed)
  646.    {
  647. ?>
  648. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  649.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  650. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  651. <HEAD>
  652.  <TITLE><?php echo $this->Nm_lang['lang_othr_grid_title'?> </TITLE>
  653.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  654. <?php
  655. if ($_SESSION['scriptcase']['proc_mobile'])
  656. {
  657. ?>
  658.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  659. <?php
  660. }
  661. ?>
  662.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  663.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  664.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  665.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  666.  <META http-equiv="Pragma" content="no-cache"/>
  667.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  668. </HEAD>
  669. <BODY class="scGridPage" style="margin: 0px; overflow-x: hidden">
  670. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery.js"></script>
  671. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery/js/jquery-ui.js"></script>
  672. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/jquery_plugin/touch_punch/jquery.ui.touch-punch.min.js"></script>
  673. <script language="javascript" type="text/javascript" src="<?php echo $_SESSION['sc_session']['path_third'?>/tigra_color_picker/picker.js"></script>
  674. <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['sc_session']['path_third'?>/font-awesome/css/all.min.css" />
  675. <?php
  676.    }
  677. ?>
  678. <FORM name="Fsel_campos" method="POST">
  679. <?php
  680. if ($this->embbed)
  681. {
  682.     echo "   <div class='scAppDivMoldura'>";
  683.     echo "   <table id=\"main_table\" style=\"width: 100%\" cellspacing=0 cellpadding=0>";
  684. }
  685. elseif ($_SESSION['scriptcase']['reg_conf']['html_dir'] == " DIR='RTL'")
  686. {
  687.     echo "   <table id=\"main_table\" style=\"position: relative; top: 20px; right: 20px\">";
  688. }
  689. else
  690. {
  691.     echo "   <table id=\"main_table\" style=\"position: relative; top: 20px; left: 20px\">";
  692. }
  693. ?>
  694. <?php
  695. if (!$this->embbed)
  696. {
  697. ?>
  698.   <tr>
  699.      <td>
  700.         <div class="scGridBorder">
  701.            <table width='100%' cellspacing=0 cellpadding=0>
  702. <?php
  703. }
  704. ?>
  705.               <tr>
  706.                  <td class="<?php echo ($this->embbed)? 'scAppDivHeader scAppDivHeaderText':'scGridLabelVert'?>">
  707.                     <?php echo $this->Nm_lang['lang_btns_clmn_hint']; ?>
  708.                  </td>
  709.                 </tr>
  710.                 <tr>
  711.                  <td class="<?php echo ($this->embbed)? 'scAppDivContent css_scAppDivContentText':'scGridTabelaTd'?>">
  712.                     <?php $this->displayHtml(!$this->embbed); ?>
  713.                  </td>
  714.                 </tr>
  715.                 <tr>
  716.                  <td class="<?php echo ($this->embbed)? 'scAppDivToolbar':'scGridToolbar'?>">
  717. <?php
  718.   $disp_rest "none";
  719.   if (isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel']) && $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel'] != $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel_orig']) {
  720.       $disp_rest "";
  721.   }
  722.   else {
  723.       $order_orig = array();
  724.       $order_atu  = array();
  725.       foreach ($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order_orig'] as $ix => $cmp) {
  726.           if (!isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel_orig'][$cmp]) || $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel_orig'][$cmp] != "off") {
  727.               $order_orig[] = $cmp;
  728.           }
  729.       }
  730.       foreach ($_SESSION['sc_session'][$this->sc_init]['grid_new']['field_order'] as $ix => $cmp) {
  731.           if (!isset($_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel'][$cmp]) || $_SESSION['sc_session'][$this->sc_init]['grid_new']['usr_cmp_sel'][$cmp] != "off") {
  732.               $order_atu[] = $cmp;
  733.           }
  734.       }
  735.       if ($order_orig != $order_atu) {
  736.           $disp_rest "";
  737.       }
  738.   }
  739.    if (!$this->embbed)
  740.    {
  741. ?>
  742.    <?php echo nmButtonOutput($this->arr_buttons"bok_appdiv""proc_btn_sel('f_sel_sub_sel','submit_form_Fsel()')""proc_btn_sel('f_sel_sub_sel','submit_form_Fsel()')""f_sel_sub_sel""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  743. ?>
  744. <?php
  745.    }
  746.    else
  747.    {
  748. ?>
  749.    <?php echo nmButtonOutput($this->arr_buttons"bapply_appdiv""proc_btn_sel('f_sel_sub_sel', 'scSubmitSelCampos(\\'" NM_encode_input($this->tbar_pos) . "\\')')""proc_btn_sel('f_sel_sub_sel', 'scSubmitSelCampos(\\'" NM_encode_input($this->tbar_pos) . "\\')')""f_sel_sub_sel""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  750. ?>
  751. <?php
  752.    }
  753. ?>
  754.   &nbsp;&nbsp;&nbsp
  755. <?php
  756.    if (!$this->embbed)
  757.    {
  758. ?>
  759.    <?php echo nmButtonOutput($this->arr_buttons"brestore_appdiv""proc_btn_sel('Brestore_sel','restore_sel()')""proc_btn_sel('Brestore_sel','restore_sel()')""Brestore_sel""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  760. ?>
  761. <?php
  762.    }
  763.    else
  764.    {
  765. ?>
  766.    <?php echo nmButtonOutput($this->arr_buttons"brestore_appdiv""proc_btn_sel('Brestore_sel','restore_sel()')""proc_btn_sel('Brestore_sel','restore_sel()')""Brestore_sel""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  767. ?>
  768. <?php
  769.    }
  770. ?>
  771.   &nbsp;&nbsp;&nbsp
  772. <?php
  773.    if (!$this->embbed)
  774.    {
  775. ?>
  776.    <?php echo nmButtonOutput($this->arr_buttons"bsair_appdiv""self.parent.tb_remove(); buttonunselectedSF();""self.parent.tb_remove(); buttonunselectedSF();""Bsair""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  777. ?>
  778. <?php
  779.    }
  780.    else
  781.    {
  782. ?>
  783.    <?php echo nmButtonOutput($this->arr_buttons"bcancelar_appdiv""scBtnSelCamposHide('" NM_encode_input($this->tbar_pos) . "'); buttonunselectedSF();""scBtnSelCamposHide('" NM_encode_input($this->tbar_pos) . "'); buttonunselectedSF();""Bsair""""""""absmiddle""""0px"$this->path_btn"""""""""""only_text""text_right""""""""""""""");
  784. ?>
  785. <?php
  786.    }
  787. ?>
  788.                  </td>
  789.               </tr>
  790. <?php
  791. if (!$this->embbed)
  792. {
  793. ?>
  794.            </table>
  795.         </div>
  796.     </td>
  797.   </tr>
  798. <?php
  799. }
  800. ?>
  801.  </table>
  802. <?php
  803. if ($this->embbed)
  804. {
  805. ?>
  806.     </div>
  807. <?php
  808. }
  809. ?>
  810. </FORM>
  811. <script language="javascript"> 
  812. function buttonDisable_sel(buttonId) {
  813.    $("#" + buttonId).prop("disabled", true).addClass("disabled");
  814. }
  815. function buttonSelectedSF() {
  816.    $("#selcmp_top").addClass("selected");
  817.    $("#selcmp_bottom").addClass("selected");
  818. }
  819. function buttonunselectedSF() {
  820.    $("#selcmp_top").removeClass("selected");
  821.    $("#selcmp_bottom").removeClass("selected");
  822. }
  823. function buttonEnable_sel(buttonId) {
  824.    $("#" + buttonId).prop("disabled", false).removeClass("disabled");
  825. }
  826. $(document).ready(function() {
  827.    if (typeof(buttonDisable_sel) === 'function') buttonDisable_sel("f_sel_sub_sel");
  828.    buttonSelectedSF();
  829. <?php
  830.    if ($disp_rest == "none") {
  831. ?>
  832.    if (typeof(buttonDisable_sel) === 'function') buttonDisable_sel("Brestore_sel");
  833. <?php
  834.    }
  835. ?>
  836. });
  837. </script>
  838. <?php
  839.    if (!$this->embbed)
  840.    {
  841. ?>
  842. <script language="javascript"> 
  843. var bFixed = false;
  844. function ajusta_window_Fsel()
  845. {
  846.   var mt = $(document.getElementById("main_table"));
  847.   if (0 == mt.width() || 0 == mt.height())
  848.   {
  849.     setTimeout("ajusta_window_Fsel()", 50);
  850.     return;
  851.   }
  852.   else if(!bFixed)
  853.   {
  854.     var oOrig = $(document.Fsel_campos.sel_orig),
  855.         oDest = $(document.Fsel_campos.sel_dest),
  856.         mHeight = Math.max(oOrig.height(), oDest.height()),
  857.         mWidth = Math.max(oOrig.width() + 5, oDest.width() + 5);
  858.     oOrig.height(mHeight);
  859.     oOrig.width(mWidth);
  860.     oDest.height(mHeight);
  861.     oDest.width(mWidth);
  862.     bFixed = true;
  863.     if (navigator.userAgent.indexOf("Chrome/") > 0)
  864.     {
  865.       strMaxHeight = Math.min(($(window.parent).height()-80), mt.height());
  866.       self.parent.tb_resize(strMaxHeight + 40, mt.width() + 40);
  867.       setTimeout("ajusta_window_Fsel()", 50);
  868.       return;
  869.     }
  870.   }
  871.   strMaxHeight = Math.min(($(window.parent).height()-80), mt.height());
  872.   self.parent.tb_resize(strMaxHeight + 40, mt.width() + 40);
  873. }
  874. $( document ).ready(function() {
  875.   ajusta_window_Fsel();
  876. });
  877. </script>
  878. <script>
  879.   ajusta_window_Fsel();
  880. </script>
  881. </BODY>
  882. </HTML>
  883. <?php
  884.    }
  885.    if ($this->proc_ajax)
  886.    {
  887.        ob_end_clean();
  888.        $oJson = new Services_JSON();
  889.        echo $oJson->encode($this->ajax_return);
  890.        exit;
  891.    }
  892. }
  893. }
Return
grid_new_session.php
  1. <?php
  2.    $NM_session_db false;
  3.    $NM_session_prod  "";
  4.    $NM_session_conf  "";
  5.    $NM_session_conex "";
  6.    $NM_session_tab   "";
  7.    $NM_session_sch   "";
  8.    if ($NM_session_db && !defined('NM_CONTR_SESS_DB'))
  9.    {
  10.        $NM_dir_atual getcwd();
  11.        if (empty($NM_dir_atual))
  12.        {
  13.            $str_path_sys = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  14.            $str_path_sys str_replace("\\"'/'$str_path_sys);
  15.        }
  16.        else
  17.        {
  18.            $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  19.            $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  20.        }
  21.        //check publication with the prod
  22.        $str_path_apl_url $_SERVER['PHP_SELF'];
  23.        $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  24.        $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  25.        $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  26.        $str_path_apl_dir substr($str_path_sys0strrpos($str_path_sys"/"));
  27.        $str_path_apl_dir substr($str_path_apl_dir0strrpos($str_path_apl_dir"/")+1);
  28.        //check prod
  29.        if(empty($NM_session_prod))
  30.        {
  31.                /*check prod*/$NM_session_prod $str_path_apl_url "_lib/prod/";
  32.        }
  33.        //end check publication with the prod
  34.        $str_path_web $_SERVER['PHP_SELF'];
  35.        $str_path_web str_replace("\\"'/'$str_path_web);
  36.        $str_path_web str_replace('//''/'$str_path_web);
  37.        $root         substr($str_path_sys0, -strlen($str_path_web));
  38.        $NM_session_prod $root $NM_session_prod;
  39.        if (empty($NM_session_conf))
  40.        {
  41.            $NM_session_conf substr($NM_session_prod0strrpos($NM_session_prod'/'));
  42.            $NM_session_conf substr($NM_session_conf0strrpos($NM_session_conf'/')) . "/conf";
  43.        }
  44.        include_once($NM_session_prod "/lib/php/nm_session.php");
  45.        $sc_session  = new sc_session();
  46.        $sc_sess_sch $NM_session_sch;
  47.        $sc_sess_tab $NM_session_tab;
  48.        $sc_sess_db  $sc_session->conect($NM_session_conex$sc_sess_tab$NM_session_prod$NM_session_conf);
  49.        if ($sc_session->testTable($sc_sess_db$sc_sess_tab$sc_sess_sch))
  50.        {
  51.            $mDbSessResult ini_set('session.save_handler''user');
  52.            if (false !== $mDbSessResult)
  53.            {
  54.                session_set_save_handler(array($sc_session'open'),
  55.                                         array($sc_session'close'),
  56.                                         array($sc_session'read'),
  57.                                         array($sc_session'write'),
  58.                                         array($sc_session'destroy'),
  59.                                         array($sc_session'gc')
  60.                                        );
  61.            }
  62.        }
  63.        define('NM_CONTR_SESS_DB'TRUE);
  64.    }
  65. ?>
Return
grid_new_teste.php
  1. <?php  
  2.   include_once('grid_new_session.php');
  3.   session_start() ;
  4.   class grid_new_form_teste
  5.   {
  6.   function grid_new_teste()
  7.   {
  8.     include("../_lib/lang/en_us.lang.php");
  9.     $_SESSION['scriptcase']['charset'] = (isset($this->Nm_lang['Nm_charset']) && !empty($this->Nm_lang['Nm_charset'])) ? $this->Nm_lang['Nm_charset'] : "UTF-8";
  10.     $sc_charset['UTF-8'] = 'utf-8';
  11.     $sc_charset['ISO-2022-JP'] = 'iso-2022-jp';
  12.     $sc_charset['ISO-2022-KR'] = 'iso-2022-kr';
  13.     $sc_charset['ISO-8859-1'] = 'iso-8859-1';
  14.     $sc_charset['ISO-8859-2'] = 'iso-8859-2';
  15.     $sc_charset['ISO-8859-3'] = 'iso-8859-3';
  16.     $sc_charset['ISO-8859-4'] = 'iso-8859-4';
  17.     $sc_charset['ISO-8859-5'] = 'iso-8859-5';
  18.     $sc_charset['ISO-8859-6'] = 'iso-8859-6';
  19.     $sc_charset['ISO-8859-7'] = 'iso-8859-7';
  20.     $sc_charset['ISO-8859-8'] = 'iso-8859-8';
  21.     $sc_charset['ISO-8859-8-I'] = 'iso-8859-8-i';
  22.     $sc_charset['ISO-8859-9'] = 'iso-8859-9';
  23.     $sc_charset['ISO-8859-10'] = 'iso-8859-10';
  24.     $sc_charset['ISO-8859-13'] = 'iso-8859-13';
  25.     $sc_charset['ISO-8859-14'] = 'iso-8859-14';
  26.     $sc_charset['ISO-8859-15'] = 'iso-8859-15';
  27.     $sc_charset['WINDOWS-1250'] = 'windows-1250';
  28.     $sc_charset['WINDOWS-1251'] = 'windows-1251';
  29.     $sc_charset['WINDOWS-1252'] = 'windows-1252';
  30.     $sc_charset['TIS-620'] = 'tis-620';
  31.     $sc_charset['WINDOWS-1253'] = 'windows-1253';
  32.     $sc_charset['WINDOWS-1254'] = 'windows-1254';
  33.     $sc_charset['WINDOWS-1255'] = 'windows-1255';
  34.     $sc_charset['WINDOWS-1256'] = 'windows-1256';
  35.     $sc_charset['WINDOWS-1257'] = 'windows-1257';
  36.     $sc_charset['KOI8-R'] = 'koi8-r';
  37.     $sc_charset['BIG-5'] = 'big5';
  38.     $sc_charset['EUC-CN'] = 'EUC-CN';
  39.     $sc_charset['GB18030'] = 'GB18030';
  40.     $sc_charset['GB2312'] = 'gb2312';
  41.     $sc_charset['EUC-JP'] = 'euc-jp';
  42.     $sc_charset['SJIS'] = 'shift-jis';
  43.     $sc_charset['EUC-KR'] = 'euc-kr';
  44.     ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  45.     $_SESSION['scriptcase']['charset_html']  = (isset($sc_charset[$_SESSION['scriptcase']['charset']])) ? $sc_charset[$_SESSION['scriptcase']['charset']] : $_SESSION['scriptcase']['charset'];
  46.     if (!function_exists("NM_is_utf8"))
  47.     {
  48.         include_once("../_lib/lib/php/nm_utf8.php");
  49.     }
  50. ?> 
  51. <html> 
  52. <HEAD>
  53.  <title>grid_new</title> 
  54.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  55.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  56.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  57.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  58.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  59.  <META http-equiv="Pragma" content="no-cache"/>
  60. </HEAD>
  61. <body> 
  62. <?php  
  63.   $str_path_web $_SERVER['PHP_SELF'];
  64.   $str_path_web str_replace("\\"'/'$str_path_web);
  65.   $str_path_web str_replace('//''/'$str_path_web);
  66.   $path_img     substr($str_path_web0strrpos($str_path_web'/'));
  67.   $path_img     substr($path_img0strrpos($path_img'/')) . '/';
  68.   $path_img     $path_img "_lib/img";
  69.   if (isset($_SESSION['scriptcase']['sc_outra_jan']) && $_SESSION['scriptcase']['sc_outra_jan'] == 'grid_new')
  70.   {
  71.       echo "<a href='" $_SESSION['scriptcase']['nm_sc_retorno'] . "' target='_self' onclick='javascript:window.close();'>" sc_convert_encoding($this->Nm_lang['lang_btns_rtrn_scrp_hint'], $_SESSION['scriptcase']['charset']) . "</a> \n" 
  72.   }
  73.   elseif (isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])) 
  74.   {
  75.       echo "<a href='" $_SERVER['HTTP_REFERER'] . "' target='_self'>" sc_convert_encoding($this->Nm_lang['lang_btns_exit_appl_hint'], $_SESSION['scriptcase']['charset']) . "</a> \n" 
  76.   }
  77. ?> 
  78. <br> 
  79. <B><FONT SIZE="4">grid_new</FONT></B> 
  80. <br> 
  81. <br> 
  82. <form name="FCons" method=post 
  83.                action="./" 
  84.                target="_self"> 
  85. <input type="hidden" name="script_case_session" value="<?php echo session_id() ?>"/>
  86. <input type="hidden" name="nmgp_outra_jan" value="true"/>
  87. <input type="hidden" name="nmgp_start" value="SC"/>
  88. <input type=hidden name="NM_contr_var_session" value="Yes"> 
  89. <input type=submit value="grid_new"> 
  90. </form> 
  91. <script language=javascript> 
  92. </script> 
  93. </body> 
  94. </html> 
  95. <?php
  96.   }
  97.  }
  98.   $frm_teste = new grid_new_form_teste();
  99.   $frm_teste->grid_new_teste();
  100. ?>
Return
grid_new_total.class.php
  1. <?php

  2. class grid_new_total
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;

  8.    var $nm_data;

  9.    //----- 
  10.    function __construct($sc_page)
  11.    {
  12.       $this->sc_page $sc_page;
  13.       $this->nm_data = new nm_data("en_us");
  14.       if (isset($_SESSION['sc_session'][$this->sc_page]['grid_new']['campos_busca']) && !empty($_SESSION['sc_session'][$this->sc_page]['grid_new']['campos_busca']))
  15.       { 
  16.           $Busca_temp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'];
  17.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  18.           {
  19.               $Busca_temp NM_conv_charset($Busca_temp$_SESSION['scriptcase']['charset'], "UTF-8");
  20.           }
  21.           $this->proprietarios_idproprietario $Busca_temp['proprietarios_idproprietario']; 
  22.           $tmp_pos strpos($this->proprietarios_idproprietario"##@@");
  23.           if ($tmp_pos !== false && !is_array($this->proprietarios_idproprietario))
  24.           {
  25.               $this->proprietarios_idproprietario substr($this->proprietarios_idproprietario0$tmp_pos);
  26.           }
  27.           $this->proprietarios_nome $Busca_temp['proprietarios_nome']; 
  28.           $tmp_pos strpos($this->proprietarios_nome"##@@");
  29.           if ($tmp_pos !== false && !is_array($this->proprietarios_nome))
  30.           {
  31.               $this->proprietarios_nome substr($this->proprietarios_nome0$tmp_pos);
  32.           }
  33.           $this->proprietarios_sexo $Busca_temp['proprietarios_sexo']; 
  34.           $tmp_pos strpos($this->proprietarios_sexo"##@@");
  35.           if ($tmp_pos !== false && !is_array($this->proprietarios_sexo))
  36.           {
  37.               $this->proprietarios_sexo substr($this->proprietarios_sexo0$tmp_pos);
  38.           }
  39.           $this->proprietarios_cpf $Busca_temp['proprietarios_cpf']; 
  40.           $tmp_pos strpos($this->proprietarios_cpf"##@@");
  41.           if ($tmp_pos !== false && !is_array($this->proprietarios_cpf))
  42.           {
  43.               $this->proprietarios_cpf substr($this->proprietarios_cpf0$tmp_pos);
  44.           }
  45.       } 
  46.    }

  47.    //---- 
  48.    function quebra_geral_sc_free_total($res_limit=false)
  49.    {
  50.       global $nada$nm_lang ;
  51.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral'] == "OK"
  52.       { 
  53.           return; 
  54.       } 
  55.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'] = array() ;  
  56.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
  57.       { 
  58.           $nm_comando "select count(*) from " $this->Ini->nm_tabela " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']; 
  59.       } 
  60.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  61.       { 
  62.           $nm_comando "select count(*) from " $this->Ini->nm_tabela " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']; 
  63.       } 
  64.       else 
  65.       { 
  66.           $nm_comando "select count(*) from " $this->Ini->nm_tabela " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']; 
  67.       } 
  68.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando;
  69.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = '';
  70.       if (!$rt $this->Db->Execute($nm_comando)) 
  71.       { 
  72.          $this->Erro->mensagem (__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
  73.          exit ; 
  74.       }
  75.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][0] = "" $this->Ini->Nm_lang['lang_msgs_totl'] . ""
  76.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1] = $rt->fields[0] ; 
  77.       $rt->Close(); 
  78.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral'] = "OK";
  79.    } 

  80.    function nm_conv_data_db($dt_in$form_in$form_out)
  81.    {
  82.        $dt_out $dt_in;
  83.        if (strtoupper($form_in) == "DB_FORMAT")
  84.        {
  85.            if ($dt_out == "null" || $dt_out == "")
  86.            {
  87.                $dt_out "";
  88.                return $dt_out;
  89.            }
  90.            $form_in "AAAA-MM-DD";
  91.        }
  92.        if (strtoupper($form_out) == "DB_FORMAT")
  93.        {
  94.            if (empty($dt_out))
  95.            {
  96.                $dt_out "null";
  97.                return $dt_out;
  98.            }
  99.            $form_out "AAAA-MM-DD";
  100.        }
  101.        nm_conv_form_data($dt_out$form_in$form_out);
  102.        return $dt_out;
  103.    }
  104.    function nm_gera_mask(&$nm_campo$nm_mask)
  105.    { 
  106.       $trab_campo $nm_campo;
  107.       $trab_mask  $nm_mask;
  108.       $tam_campo  strlen($nm_campo);
  109.       $trab_saida "";
  110.       $mask_num false;
  111.       for ($x=0$x strlen($trab_mask); $x++)
  112.       {
  113.           if (substr($trab_mask$x1) == "#")
  114.           {
  115.               $mask_num true;
  116.               break;
  117.           }
  118.       }
  119.       if ($mask_num )
  120.       {
  121.           $ver_duas explode(";"$trab_mask);
  122.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  123.           {
  124.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  125.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  126.               if ($cont2 >= $tam_campo)
  127.               {
  128.                   $trab_mask $ver_duas[1];
  129.               }
  130.               else
  131.               {
  132.                   $trab_mask $ver_duas[0];
  133.               }
  134.           }
  135.           $tam_mask strlen($trab_mask);
  136.           $xdados 0;
  137.           for ($x=0$x $tam_mask$x++)
  138.           {
  139.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  140.               {
  141.                   $trab_saida .= substr($trab_campo$xdados1);
  142.                   $xdados++;
  143.               }
  144.               elseif ($xdados $tam_campo)
  145.               {
  146.                   $trab_saida .= substr($trab_mask$x1);
  147.               }
  148.           }
  149.           if ($xdados $tam_campo)
  150.           {
  151.               $trab_saida .= substr($trab_campo$xdados);
  152.           }
  153.           $nm_campo $trab_saida;
  154.           return;
  155.       }
  156.       for ($ix strlen($trab_mask); $ix 0$ix--)
  157.       {
  158.            $char_mask substr($trab_mask$ix 11);
  159.            if ($char_mask != "x" && $char_mask != "z")
  160.            {
  161.                $trab_saida $char_mask $trab_saida;
  162.            }
  163.            else
  164.            {
  165.                if ($tam_campo != 0)
  166.                {
  167.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  168.                    $tam_campo--;
  169.                }
  170.                else
  171.                {
  172.                    $trab_saida "0" $trab_saida;
  173.                }
  174.            }
  175.       }
  176.       if ($tam_campo != 0)
  177.       {
  178.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  179.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  180.       }
  181.    
  182.       $iz 0
  183.       for ($ix 0$ix strlen($trab_mask); $ix++)
  184.       {
  185.            $char_mask substr($trab_mask$ix1);
  186.            if ($char_mask != "x" && $char_mask != "z")
  187.            {
  188.                if ($char_mask == "." || $char_mask == ",")
  189.                {
  190.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  191.                }
  192.                else
  193.                {
  194.                    $iz++;
  195.                }
  196.            }
  197.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  198.            {
  199.                $ix strlen($trab_mask) + 1;
  200.            }
  201.            else
  202.            {
  203.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  204.            }
  205.       }
  206.       $nm_campo $trab_saida;
  207.    } 
  208. }

  209. ?>
Return
grid_new_xls.class.php
  1. <?php

  2. class grid_new_xls
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;
  8.    var $nm_data;
  9.    var $Xls_dados;
  10.    var $Xls_workbook;
  11.    var $Xls_col;
  12.    var $Xls_row;
  13.    var $sc_proc_grid
  14.    var $NM_cmp_hidden = array();
  15.    var $NM_ctrl_style = array();
  16.    var $Arquivo;
  17.    var $Tit_doc;
  18.    //---- 
  19.    function __construct()
  20.    {
  21.    }

  22.    //---- 
  23.    function monta_xls()
  24.    {
  25.       $this->inicializa_vars();
  26.       $this->grava_arquivo();
  27.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida']) {
  28.           if ($this->Ini->sc_export_ajax)
  29.           {
  30.               $this->Arr_result['file_export']  = NM_charset_to_utf8($this->Xls_f);
  31.               $this->Arr_result['title_export'] = NM_charset_to_utf8($this->Tit_doc);
  32.               $Temp ob_get_clean();
  33.               if ($Temp !== false && trim($Temp) != "")
  34.               {
  35.                   $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  36.               }
  37.               $oJson = new Services_JSON();
  38.               echo $oJson->encode($this->Arr_result);
  39.               exit;
  40.           }
  41.           else
  42.           {
  43.               $this->progress_bar_end();
  44.           }
  45.       }
  46.       else { 
  47.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "";
  48.       }
  49.    }

  50.    //----- 
  51.    function inicializa_vars()
  52.    {
  53.       global $nm_lang;
  54.       $this->Use_phpspreadsheet false;
  55.       $this->Xls_tot_col 0;
  56.       $this->Xls_row     0;
  57.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  58.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  59.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  60.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  61.       { 
  62.           if ($this->Use_phpspreadsheet) {
  63.               require_once $this->Ini->path_third '/phpspreadsheet/vendor/autoload.php';
  64.           } 
  65.           else { 
  66.               set_include_path(get_include_path() . PATH_SEPARATOR $this->Ini->path_third '/phpexcel/');
  67.               require_once $this->Ini->path_third '/phpexcel/PHPExcel.php';
  68.               require_once $this->Ini->path_third '/phpexcel/PHPExcel/IOFactory.php';
  69.               require_once $this->Ini->path_third '/phpexcel/PHPExcel/Cell/AdvancedValueBinder.php';
  70.           } 
  71.       } 
  72.       $orig_form_dt strtoupper($_SESSION['scriptcase']['reg_conf']['date_format']);
  73.       $this->SC_date_conf_region "";
  74.       for ($i 0$i 8$i++)
  75.       {
  76.           if ($i && substr($orig_form_dt$i1) != substr($this->SC_date_conf_region, -11)) {
  77.               $this->SC_date_conf_region .= $_SESSION['scriptcase']['reg_conf']['date_sep'];
  78.           }
  79.           $this->SC_date_conf_region .= substr($orig_form_dt$i1);
  80.       }
  81.       $this->Xls_tp ".xlsx";
  82.       if (isset($_REQUEST['nmgp_tp_xls']) && !empty($_REQUEST['nmgp_tp_xls']))
  83.       {
  84.           $this->Xls_tp "." $_REQUEST['nmgp_tp_xls'];
  85.       }
  86.       $this->groupby_show "S";
  87.       if (isset($_REQUEST['nmgp_tot_xls']) && !empty($_REQUEST['nmgp_tot_xls']))
  88.       {
  89.           $this->groupby_show $_REQUEST['nmgp_tot_xls'];
  90.       }
  91.       $this->Xls_col      0;
  92.       $this->Tem_xls_res  false;
  93.       $this->Xls_password "";
  94.       $this->nm_data      = new nm_data("en_us");
  95.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  96.       { 
  97.           $this->Tem_xls_res  true;
  98.           if (isset($_REQUEST['SC_module_export']) && $_REQUEST['SC_module_export'] != "")
  99.           { 
  100.               $this->Tem_xls_res = (strpos(" " $_REQUEST['SC_module_export'], "resume") !== false || strpos(" " $_REQUEST['SC_module_export'], "chart") !== false) ? true false;
  101.           } 
  102.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total")
  103.           {
  104.               $this->Tem_xls_res  false;
  105.           }
  106.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  107.           {
  108.               $this->Tem_xls_res  false;
  109.           }
  110.           if ($this->Tem_xls_res)
  111.           { 
  112.               require_once($this->Ini->path_aplicacao "grid_new_res_xls.class.php");
  113.               $this->Res_xls = new grid_new_res_xls();
  114.               $this->prep_modulos("Res_xls");
  115.           } 
  116.           $this->Arquivo    "sc_xls";
  117.           $this->Arquivo   .= "_" date("YmdHis") . "_" rand(01000);
  118.           $this->Arq_zip    $this->Arquivo "_grid_new.zip";
  119.           $this->Arquivo   .= "_grid_new" $this->Xls_tp;
  120.           $this->Tit_doc    "grid_new" $this->Xls_tp;
  121.           $this->Tit_zip    "grid_new.zip";
  122.           $this->Xls_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  123.           $this->Zip_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arq_zip;
  124.           if ($this->Use_phpspreadsheet) {
  125.               $this->Xls_dados = new PhpOffice\PhpSpreadsheet\Spreadsheet();
  126.               \PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
  127.           }
  128.           else {
  129.               PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
  130.               $this->Xls_dados = new PHPExcel();
  131.           }
  132.           $this->Xls_dados->setActiveSheetIndex(0);
  133.           $this->Nm_ActiveSheet $this->Xls_dados->getActiveSheet();
  134.           $this->Nm_ActiveSheet->setTitle($this->Ini->Nm_lang['lang_othr_grid_titl']);
  135.           if ($_SESSION['scriptcase']['reg_conf']['css_dir'] == "RTL")
  136.           {
  137.               $this->Nm_ActiveSheet->setRightToLeft(true);
  138.           }
  139.       }
  140.       require_once($this->Ini->path_aplicacao "grid_new_total.class.php"); 
  141.       $this->Tot = new grid_new_total($this->Ini->sc_page);
  142.       $this->prep_modulos("Tot");
  143.       $Gb_geral "quebra_geral_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'];
  144.       $this->Tot->$Gb_geral();
  145.       $this->count_ger $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1];
  146.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && !$this->Ini->sc_export_ajax) {
  147.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  148.           $this->pb = new scProgressBar();
  149.           $this->pb->setRoot($this->Ini->root);
  150.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  151.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  152.           $this->pb->initialize();
  153.           $this->pb->setReturnUrl("./");
  154.           $this->pb->setReturnOption($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_return']);
  155.           if ($this->Tem_xls_res) {
  156.               $PB_plus intval ($this->count_ger 0.04);
  157.               $PB_plus = ($PB_plus 2) ? $PB_plus;
  158.           }
  159.           else {
  160.               $PB_plus intval ($this->count_ger 0.02);
  161.               $PB_plus = ($PB_plus 1) ? $PB_plus;
  162.           }
  163.           $PB_tot $this->count_ger $PB_plus;
  164.           $this->PB_dif $PB_tot $this->count_ger;
  165.           $this->pb->setTotalSteps($PB_tot );
  166.       }
  167.    }
  168.    //---- 
  169.    function prep_modulos($modulo)
  170.    {
  171.       $this->$modulo->Ini    $this->Ini;
  172.       $this->$modulo->Db     $this->Db;
  173.       $this->$modulo->Erro   $this->Erro;
  174.       $this->$modulo->Lookup $this->Lookup;
  175.    }


  176.    //----- 
  177.    function grava_arquivo()
  178.    {
  179.       global $nm_nada$nm_lang;

  180.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  181.       $this->sc_proc_grid false
  182.       $nm_raiz_img  ""
  183.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name']))
  184.       {
  185.           $this->Arquivo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'];
  186.           $this->Arq_zip $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'];
  187.           $this->Tit_doc $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'];
  188.           $Pos strrpos($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'], ".");
  189.           if ($Pos !== false) {
  190.               $this->Arq_zip substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name'], 0$Pos);
  191.           }
  192.           $this->Arq_zip .= ".zip";
  193.           $this->Tit_zip  $this->Arq_zip;
  194.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_name']);
  195.           $this->Xls_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  196.           $this->Zip_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arq_zip;
  197.       }
  198.       if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']))
  199.       {
  200.           foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display'] as $NM_cada_field => $NM_cada_opc)
  201.           {
  202.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  203.           }
  204.       }
  205.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']))
  206.       {
  207.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  208.           {
  209.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  210.           }
  211.       }
  212.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']))
  213.       {
  214.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  215.           {
  216.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  217.           }
  218.       }
  219.       foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_cmp)
  220.       {
  221.           if (!isset($this->NM_cmp_hidden[$Cada_cmp]) || $this->NM_cmp_hidden[$Cada_cmp] != "off")
  222.           {
  223.               $this->Xls_tot_col++;
  224.           }
  225.       }
  226.       $this->sc_where_orig   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  227.       $this->sc_where_atual  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  228.       $this->sc_where_filtro $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'];
  229.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']))
  230.       { 
  231.           $Busca_temp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'];
  232.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  233.           {
  234.               $Busca_temp NM_conv_charset($Busca_temp$_SESSION['scriptcase']['charset'], "UTF-8");
  235.           }
  236.           $this->proprietarios_idproprietario $Busca_temp['proprietarios_idproprietario']; 
  237.           $tmp_pos strpos($this->proprietarios_idproprietario"##@@");
  238.           if ($tmp_pos !== false && !is_array($this->proprietarios_idproprietario))
  239.           {
  240.               $this->proprietarios_idproprietario substr($this->proprietarios_idproprietario0$tmp_pos);
  241.           }
  242.           $this->proprietarios_nome $Busca_temp['proprietarios_nome']; 
  243.           $tmp_pos strpos($this->proprietarios_nome"##@@");
  244.           if ($tmp_pos !== false && !is_array($this->proprietarios_nome))
  245.           {
  246.               $this->proprietarios_nome substr($this->proprietarios_nome0$tmp_pos);
  247.           }
  248.           $this->proprietarios_sexo $Busca_temp['proprietarios_sexo']; 
  249.           $tmp_pos strpos($this->proprietarios_sexo"##@@");
  250.           if ($tmp_pos !== false && !is_array($this->proprietarios_sexo))
  251.           {
  252.               $this->proprietarios_sexo substr($this->proprietarios_sexo0$tmp_pos);
  253.           }
  254.           $this->proprietarios_cpf $Busca_temp['proprietarios_cpf']; 
  255.           $tmp_pos strpos($this->proprietarios_cpf"##@@");
  256.           if ($tmp_pos !== false && !is_array($this->proprietarios_cpf))
  257.           {
  258.               $this->proprietarios_cpf substr($this->proprietarios_cpf0$tmp_pos);
  259.           }
  260.       } 
  261.       $this->arr_export = array('label' => array(), 'lines' => array());
  262.       $this->arr_span   = array();

  263.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_label']) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_label'])
  264.       { 
  265.           $this->count_span 0;
  266.           $this->Xls_row++;
  267.           $this->proc_label();
  268.           $_SESSION['scriptcase']['export_return'] = $this->arr_export;
  269.           return;
  270.       } 
  271.       $this->nm_field_dinamico = array();
  272.       $this->nm_order_dinamico = array();
  273.       $nmgp_select_count "SELECT count(*) AS countTest from " $this->Ini->nm_tabela
  274.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
  275.       { 
  276.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  277.       } 
  278.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  279.       { 
  280.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  281.       } 
  282.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  283.       { 
  284.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  285.       } 
  286.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  287.       { 
  288.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  289.       } 
  290.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
  291.       { 
  292.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  293.       } 
  294.       else 
  295.       { 
  296.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  297.       } 
  298.       $nmgp_select .= " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  299.       $nmgp_select_count .= " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  300.       $nmgp_order_by $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['order_grid'];
  301.       $nmgp_select .= $nmgp_order_by
  302.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select;
  303.       $rs $this->Db->Execute($nmgp_select);
  304.       if ($rs === false && !$rs->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1)
  305.       {
  306.          $this->Erro->mensagem(__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg());
  307.          exit;
  308.       }
  309.       $this->SC_seq_register 0;
  310.       $prim_reg true;
  311.       $prim_gb  true;
  312.       $nm_houve_quebra "N";
  313.       $PB_tot = (isset($this->count_ger) && $this->count_ger 0) ? "/" $this->count_ger "";
  314.       while (!$rs->EOF)
  315.       {
  316.          $this->SC_seq_register++;
  317.          $prim_reg false;
  318.          if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && !$this->Ini->sc_export_ajax) {
  319.              $Mens_bar $this->Ini->Nm_lang['lang_othr_prcs'];
  320.              if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  321.                  $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  322.              }
  323.              $this->pb->setProgressbarMessage($Mens_bar ": " $this->SC_seq_register $PB_tot);
  324.              $this->pb->addSteps(1);
  325.          }
  326.          $this->Xls_col 0;
  327.          $this->Xls_row++;
  328.          $this->proprietarios_idproprietario $rs->fields[0] ;  
  329.          $this->proprietarios_idproprietario = (string)$this->proprietarios_idproprietario;
  330.          $this->proprietarios_nome $rs->fields[1] ;  
  331.          $this->proprietarios_sexo $rs->fields[2] ;  
  332.          $this->proprietarios_cpf $rs->fields[3] ;  
  333.          $this->proprietarios_cpf = (string)$this->proprietarios_cpf;
  334.          $this->proprietarios_telefone $rs->fields[4] ;  
  335.          $this->veiculos_idveiculos $rs->fields[5] ;  
  336.          $this->veiculos_idveiculos = (string)$this->veiculos_idveiculos;
  337.          $this->veiculos_anomodelo $rs->fields[6] ;  
  338.          $this->veiculos_placa $rs->fields[7] ;  
  339.          $this->proprietarios_endereco $rs->fields[8] ;  
  340.      if ($this->groupby_show == "S") {
  341.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  342.          { 
  343.              if ($prim_gb) {
  344.                  $this->count_span 0;
  345.                  $this->proc_label();
  346.              }
  347.              if ($prim_gb || $nm_houve_quebra == "S") {
  348.                  $this->xls_sub_cons_copy_label($this->Xls_row);
  349.                  $this->Xls_row++;
  350.              }
  351.          }
  352.          elseif ($prim_gb || $nm_houve_quebra == "S")
  353.          {
  354.              $this->count_span 0;
  355.              $this->proc_label();
  356.          }
  357.      }
  358.      else {
  359.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  360.          { 
  361.              if ($prim_gb)
  362.              {
  363.                  $this->count_span 0;
  364.                  $this->proc_label();
  365.                  $this->xls_sub_cons_copy_label($this->Xls_row);
  366.                  $this->Xls_row++;
  367.              }
  368.          }
  369.          elseif ($prim_gb)
  370.          {
  371.              $this->count_span 0;
  372.              $this->proc_label();
  373.          }
  374.      }
  375.      $prim_gb false;
  376.      $nm_houve_quebra "N";
  377.          $this->sc_proc_grid true
  378.          foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_col)
  379.          { 
  380.             if (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off")
  381.             { 
  382.                 if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  383.                 { 
  384.                     $NM_func_exp "NM_sub_cons_" $Cada_col;
  385.                     $this->$NM_func_exp();
  386.                 } 
  387.                 else 
  388.                 { 
  389.                     $NM_func_exp "NM_export_" $Cada_col;
  390.                     $this->$NM_func_exp();
  391.                 } 
  392.             } 
  393.          } 
  394.          if (isset($this->NM_Row_din) && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  395.          { 
  396.              foreach ($this->NM_Row_din as $row => $height
  397.              { 
  398.                  $this->Nm_ActiveSheet->getRowDimension($row)->setRowHeight($height);
  399.              } 
  400.          } 
  401.          $this->xls_set_style();
  402.          $rs->MoveNext();
  403.       }
  404.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $prim_reg)
  405.       { 
  406.           $this->proc_label();
  407.           $this->xls_sub_cons_copy_label($this->Xls_row);
  408.           $nm_grid_sem_reg $this->Ini->Nm_lang['lang_errm_empt']; 
  409.           if (!NM_is_utf8($nm_grid_sem_reg ))
  410.           {
  411.               $nm_grid_sem_reg  sc_convert_encoding($nm_grid_sem_reg "UTF-8"$_SESSION['scriptcase']['charset']);
  412.           }
  413.           $this->Xls_row++;
  414.           $this->arr_export['lines'][$this->Xls_row][1]['data']   = $nm_grid_sem_reg;
  415.           $this->arr_export['lines'][$this->Xls_row][1]['align']  = "right";
  416.           $this->arr_export['lines'][$this->Xls_row][1]['type']   = "char";
  417.           $this->arr_export['lines'][$this->Xls_row][1]['format'] = "";
  418.       }
  419.       if (isset($this->NM_Col_din) && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  420.       { 
  421.           foreach ($this->NM_Col_din as $col => $width)
  422.           { 
  423.               $this->Nm_ActiveSheet->getColumnDimension($col)->setWidth($width 5);
  424.           } 
  425.       } 
  426.       if ($this->groupby_show == "S") {
  427.       }
  428.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  429.       { 
  430.           if ($this->Tem_xls_res)
  431.           { 
  432.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_grid'] = true;
  433.               if (!$this->Ini->sc_export_ajax) {
  434.                   $this->PB_dif intval ($this->PB_dif 2);
  435.                   $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  436.                   $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  437.                   if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  438.                       $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  439.                       $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  440.                   }
  441.                   $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  442.                   $this->pb->addSteps($this->PB_dif);
  443.               }
  444.               $this->Res_xls->monta_xls();
  445.               if ($this->Use_phpspreadsheet) {
  446.                   $Xls_res = \PhpOffice\PhpSpreadsheet\IOFactory::load($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_sheet']);
  447.               }
  448.               else {
  449.                   $Xls_res PHPExcel_IOFactory::load($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_sheet']);
  450.               }
  451.               foreach($Xls_res->getAllSheets() as $sheet)
  452.               {
  453.                   $this->Xls_dados->addExternalSheet($sheet);
  454.               }
  455.               unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_grid']);
  456.               unlink($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_res_sheet']);
  457.           } 
  458.           if (!$this->Ini->sc_export_ajax) {
  459.               $Mens_bar $this->Ini->Nm_lang['lang_btns_export_finished'];
  460.               if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  461.                   $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  462.               }
  463.               $this->pb->setProgressbarMessage($Mens_bar);
  464.               $this->pb->addSteps($this->PB_dif);
  465.           }
  466.           if ($this->Use_phpspreadsheet) {
  467.               if ($this->Xls_tp == ".xlsx") {
  468.                   $objWriter = new PhpOffice\PhpSpreadsheet\Writer\Xlsx($this->Xls_dados);
  469.               } 
  470.               else {
  471.                   $objWriter = new PhpOffice\PhpSpreadsheet\Writer\Xls($this->Xls_dados);
  472.               } 
  473.           } 
  474.           else {
  475.               if ($this->Xls_tp == ".xlsx") {
  476.                   $objWriter = new PHPExcel_Writer_Excel2007($this->Xls_dados);
  477.               } 
  478.               else {
  479.                   $objWriter = new PHPExcel_Writer_Excel5($this->Xls_dados);
  480.               } 
  481.           } 
  482.           $objWriter->save($this->Xls_f);
  483.           if ($this->Xls_password != "")
  484.           { 
  485.               $str_zip   "";
  486.               $Zip_f     = (FALSE !== strpos($this->Zip_f' ')) ? " \"" $this->Zip_f "\"" :  $this->Zip_f;
  487.               $Arq_input = (FALSE !== strpos($this->Xls_f' ')) ? " \"" $this->Xls_f "\"" :  $this->Xls_f;
  488.               if (is_file($Zip_f)) {
  489.                   unlink($Zip_f);
  490.               }
  491.               if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  492.               {
  493.                   chdir($this->Ini->path_third "/zip/windows");
  494.                   $str_zip "zip.exe -P -j " $this->Xls_password " " $Zip_f " " $Arq_input;
  495.               }
  496.               elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  497.               {
  498.                   if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  499.                   {
  500.                       chdir($this->Ini->path_third "/zip/linux-i386/bin");
  501.                   }
  502.                   else
  503.                   {
  504.                      chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  505.                   }
  506.                   $str_zip "./7za -p" $this->Xls_password " a " $Zip_f " " $Arq_input;
  507.               }
  508.               elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  509.               {
  510.                   chdir($this->Ini->path_third "/zip/mac/bin");
  511.                   $str_zip "./7za -p" $this->Xls_password " a " $Zip_f " " $Arq_input;
  512.               }
  513.               if (!empty($str_zip)) {
  514.                   exec($str_zip);
  515.               }
  516.               // ----- ZIP log
  517.               $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'w');
  518.               if ($fp)
  519.               {
  520.                   @fwrite($fp$str_zip "\r\n\r\n");
  521.                   @fclose($fp);
  522.               }
  523.               unlink($Arq_input);
  524.               $this->Arquivo $this->Arq_zip;
  525.               $this->Xls_f   $this->Zip_f;
  526.               $this->Tit_doc $this->Tit_zip;
  527.           } 
  528.       } 
  529.       else 
  530.       { 
  531.           $_SESSION['scriptcase']['export_return'] = $this->arr_export;
  532.       } 
  533.       if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']))
  534.       {
  535.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order'];
  536.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']);
  537.       }
  538.       if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']))
  539.       {
  540.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel'];
  541.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']);
  542.       }
  543.       $rs->Close();
  544.    }
  545.    function proc_label()
  546.    { 
  547.       foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_col)
  548.       { 
  549.           $SC_Label = (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario"
  550.           if ($Cada_col == "proprietarios_idproprietario" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  551.           {
  552.               $this->count_span++;
  553.               $current_cell_ref $this->calc_cell($this->Xls_col);
  554.               if (!NM_is_utf8($SC_Label))
  555.               {
  556.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  557.               }
  558.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  559.               { 
  560.                   $this->arr_export['label'][$this->Xls_col]['data']     = $SC_Label;
  561.                   $this->arr_export['label'][$this->Xls_col]['align']    = "right";
  562.                   $this->arr_export['label'][$this->Xls_col]['autosize'] = "s";
  563.                   $this->arr_export['label'][$this->Xls_col]['bold']     = "s";
  564.               }
  565.               else
  566.               { 
  567.                   if ($this->Use_phpspreadsheet) {
  568.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
  569.                   }
  570.                   else {
  571.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  572.                   }
  573.                   $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$SC_Label);
  574.                   $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getFont()->setBold(true);
  575.                   $this->Nm_ActiveSheet->getColumnDimension($current_cell_ref)->setAutoSize(true);
  576.               }
  577.               $this->Xls_col++;
  578.           }
  579.           $SC_Label = (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome"
  580.           if ($Cada_col == "proprietarios_nome" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  581.           {
  582.               $this->count_span++;
  583.               $current_cell_ref $this->calc_cell($this->Xls_col);
  584.               if (!NM_is_utf8($SC_Label))
  585.               {
  586.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  587.               }
  588.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  589.               { 
  590.                   $this->arr_export['label'][$this->Xls_col]['data']     = $SC_Label;
  591.                   $this->arr_export['label'][$this->Xls_col]['align']    = "left";
  592.                   $this->arr_export['label'][$this->Xls_col]['autosize'] = "s";
  593.                   $this->arr_export['label'][$this->Xls_col]['bold']     = "s";
  594.               }
  595.               else
  596.               { 
  597.                   if ($this->Use_phpspreadsheet) {
  598.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  599.                   }
  600.                   else {
  601.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  602.                   }
  603.                   $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$SC_Label);
  604.                   $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getFont()->setBold(true);
  605.                   $this->Nm_ActiveSheet->getColumnDimension($current_cell_ref)->setAutoSize(true);
  606.               }
  607.               $this->Xls_col++;
  608.           }
  609.           $SC_Label = (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo"
  610.           if ($Cada_col == "proprietarios_sexo" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  611.           {
  612.               $this->count_span++;
  613.               $current_cell_ref $this->calc_cell($this->Xls_col);
  614.               if (!NM_is_utf8($SC_Label))
  615.               {
  616.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  617.               }
  618.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  619.               { 
  620.                   $this->arr_export['label'][$this->Xls_col]['data']     = $SC_Label;
  621.                   $this->arr_export['label'][$this->Xls_col]['align']    = "left";
  622.                   $this->arr_export['label'][$this->Xls_col]['autosize'] = "s";
  623.                   $this->arr_export['label'][$this->Xls_col]['bold']     = "s";
  624.               }
  625.               else
  626.               { 
  627.                   if ($this->Use_phpspreadsheet) {
  628.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  629.                   }
  630.                   else {
  631.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  632.                   }
  633.                   $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$SC_Label);
  634.                   $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getFont()->setBold(true);
  635.                   $this->Nm_ActiveSheet->getColumnDimension($current_cell_ref)->setAutoSize(true);
  636.               }
  637.               $this->Xls_col++;
  638.           }
  639.           $SC_Label = (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf"
  640.           if ($Cada_col == "proprietarios_cpf" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  641.           {
  642.               $this->count_span++;
  643.               $current_cell_ref $this->calc_cell($this->Xls_col);
  644.               if (!NM_is_utf8($SC_Label))
  645.               {
  646.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  647.               }
  648.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  649.               { 
  650.                   $this->arr_export['label'][$this->Xls_col]['data']     = $SC_Label;
  651.                   $this->arr_export['label'][$this->Xls_col]['align']    = "right";
  652.                   $this->arr_export['label'][$this->Xls_col]['autosize'] = "s";
  653.                   $this->arr_export['label'][$this->Xls_col]['bold']     = "s";
  654.               }
  655.               else
  656.               { 
  657.                   if ($this->Use_phpspreadsheet) {
  658.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
  659.                   }
  660.                   else {
  661.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  662.                   }
  663.                   $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$SC_Label);
  664.                   $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getFont()->setBold(true);
  665.                   $this->Nm_ActiveSheet->getColumnDimension($current_cell_ref)->setAutoSize(true);
  666.               }
  667.               $this->Xls_col++;
  668.           }
  669.           $SC_Label = (isset($this->New_label['proprietarios_telefone'])) ? $this->New_label['proprietarios_telefone'] : "Telefone"
  670.           if ($Cada_col == "proprietarios_telefone" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  671.           {
  672.               $this->count_span++;
  673.               $current_cell_ref $this->calc_cell($this->Xls_col);
  674.               if (!NM_is_utf8($SC_Label))
  675.               {
  676.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  677.               }
  678.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  679.               { 
  680.                   $this->arr_export['label'][$this->Xls_col]['data']     = $SC_Label;
  681.                   $this->arr_export['label'][$this->Xls_col]['align']    = "left";
  682.                   $this->arr_export['label'][$this->Xls_col]['autosize'] = "s";
  683.                   $this->arr_export['label'][$this->Xls_col]['bold']     = "s";
  684.               }
  685.               else
  686.               { 
  687.                   if ($this->Use_phpspreadsheet) {
  688.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  689.                   }
  690.                   else {
  691.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  692.                   }
  693.                   $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$SC_Label);
  694.                   $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getFont()->setBold(true);
  695.                   $this->Nm_ActiveSheet->getColumnDimension($current_cell_ref)->setAutoSize(true);
  696.               }
  697.               $this->Xls_col++;
  698.           }
  699.           $SC_Label = (isset($this->New_label['veiculos_idveiculos'])) ? $this->New_label['veiculos_idveiculos'] : "Id Veiculos"
  700.           if ($Cada_col == "veiculos_idveiculos" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  701.           {
  702.               $this->count_span++;
  703.               $current_cell_ref $this->calc_cell($this->Xls_col);
  704.               if (!NM_is_utf8($SC_Label))
  705.               {
  706.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  707.               }
  708.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  709.               { 
  710.                   $this->arr_export['label'][$this->Xls_col]['data']     = $SC_Label;
  711.                   $this->arr_export['label'][$this->Xls_col]['align']    = "right";
  712.                   $this->arr_export['label'][$this->Xls_col]['autosize'] = "s";
  713.                   $this->arr_export['label'][$this->Xls_col]['bold']     = "s";
  714.               }
  715.               else
  716.               { 
  717.                   if ($this->Use_phpspreadsheet) {
  718.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
  719.                   }
  720.                   else {
  721.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  722.                   }
  723.                   $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$SC_Label);
  724.                   $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getFont()->setBold(true);
  725.                   $this->Nm_ActiveSheet->getColumnDimension($current_cell_ref)->setAutoSize(true);
  726.               }
  727.               $this->Xls_col++;
  728.           }
  729.           $SC_Label = (isset($this->New_label['veiculos_anomodelo'])) ? $this->New_label['veiculos_anomodelo'] : "Ano Modelo"
  730.           if ($Cada_col == "veiculos_anomodelo" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  731.           {
  732.               $this->count_span++;
  733.               $current_cell_ref $this->calc_cell($this->Xls_col);
  734.               if (!NM_is_utf8($SC_Label))
  735.               {
  736.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  737.               }
  738.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  739.               { 
  740.                   $this->arr_export['label'][$this->Xls_col]['data']     = $SC_Label;
  741.                   $this->arr_export['label'][$this->Xls_col]['align']    = "left";
  742.                   $this->arr_export['label'][$this->Xls_col]['autosize'] = "s";
  743.                   $this->arr_export['label'][$this->Xls_col]['bold']     = "s";
  744.               }
  745.               else
  746.               { 
  747.                   if ($this->Use_phpspreadsheet) {
  748.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  749.                   }
  750.                   else {
  751.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  752.                   }
  753.                   $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$SC_Label);
  754.                   $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getFont()->setBold(true);
  755.                   $this->Nm_ActiveSheet->getColumnDimension($current_cell_ref)->setAutoSize(true);
  756.               }
  757.               $this->Xls_col++;
  758.           }
  759.           $SC_Label = (isset($this->New_label['veiculos_placa'])) ? $this->New_label['veiculos_placa'] : "Placa"
  760.           if ($Cada_col == "veiculos_placa" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  761.           {
  762.               $this->count_span++;
  763.               $current_cell_ref $this->calc_cell($this->Xls_col);
  764.               if (!NM_is_utf8($SC_Label))
  765.               {
  766.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  767.               }
  768.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  769.               { 
  770.                   $this->arr_export['label'][$this->Xls_col]['data']     = $SC_Label;
  771.                   $this->arr_export['label'][$this->Xls_col]['align']    = "left";
  772.                   $this->arr_export['label'][$this->Xls_col]['autosize'] = "s";
  773.                   $this->arr_export['label'][$this->Xls_col]['bold']     = "s";
  774.               }
  775.               else
  776.               { 
  777.                   if ($this->Use_phpspreadsheet) {
  778.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  779.                   }
  780.                   else {
  781.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  782.                   }
  783.                   $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$SC_Label);
  784.                   $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getFont()->setBold(true);
  785.                   $this->Nm_ActiveSheet->getColumnDimension($current_cell_ref)->setAutoSize(true);
  786.               }
  787.               $this->Xls_col++;
  788.           }
  789.           $SC_Label = (isset($this->New_label['proprietarios_endereco'])) ? $this->New_label['proprietarios_endereco'] : "Endereco"
  790.           if ($Cada_col == "proprietarios_endereco" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
  791.           {
  792.               $this->count_span++;
  793.               $current_cell_ref $this->calc_cell($this->Xls_col);
  794.               if (!NM_is_utf8($SC_Label))
  795.               {
  796.                   $SC_Label sc_convert_encoding($SC_Label"UTF-8"$_SESSION['scriptcase']['charset']);
  797.               }
  798.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  799.               { 
  800.                   $this->arr_export['label'][$this->Xls_col]['data']     = $SC_Label;
  801.                   $this->arr_export['label'][$this->Xls_col]['align']    = "left";
  802.                   $this->arr_export['label'][$this->Xls_col]['autosize'] = "s";
  803.                   $this->arr_export['label'][$this->Xls_col]['bold']     = "s";
  804.               }
  805.               else
  806.               { 
  807.                   if ($this->Use_phpspreadsheet) {
  808.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  809.                   }
  810.                   else {
  811.                       $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  812.                   }
  813.                   $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$SC_Label);
  814.                   $this->Nm_ActiveSheet->getStyle($current_cell_ref $this->Xls_row)->getFont()->setBold(true);
  815.                   $this->Nm_ActiveSheet->getColumnDimension($current_cell_ref)->setAutoSize(true);
  816.               }
  817.               $this->Xls_col++;
  818.           }
  819.       } 
  820.       $this->Xls_col 0;
  821.       $this->Xls_row++;
  822.    } 
  823.    //----- proprietarios_idproprietario
  824.    function NM_export_proprietarios_idproprietario()
  825.    {
  826.          $current_cell_ref $this->calc_cell($this->Xls_col);
  827.          if (!isset($this->NM_ctrl_style[$current_cell_ref])) {
  828.              $this->NM_ctrl_style[$current_cell_ref]['ini'] = $this->Xls_row;
  829.              $this->NM_ctrl_style[$current_cell_ref]['align'] = "RIGHT"
  830.          }
  831.          $this->NM_ctrl_style[$current_cell_ref]['end'] = $this->Xls_row;
  832.          if (!NM_is_utf8($this->proprietarios_idproprietario))
  833.          {
  834.              $this->proprietarios_idproprietario sc_convert_encoding($this->proprietarios_idproprietario"UTF-8"$_SESSION['scriptcase']['charset']);
  835.          }
  836.          if (is_numeric($this->proprietarios_idproprietario))
  837.          {
  838.              $this->NM_ctrl_style[$current_cell_ref]['format'] = '#,##0';
  839.          }
  840.          $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$this->proprietarios_idproprietario);
  841.          $this->Xls_col++;
  842.    }
  843.    //----- proprietarios_nome
  844.    function NM_export_proprietarios_nome()
  845.    {
  846.          $current_cell_ref $this->calc_cell($this->Xls_col);
  847.          if (!isset($this->NM_ctrl_style[$current_cell_ref])) {
  848.              $this->NM_ctrl_style[$current_cell_ref]['ini'] = $this->Xls_row;
  849.              $this->NM_ctrl_style[$current_cell_ref]['align'] = "LEFT"
  850.          }
  851.          $this->NM_ctrl_style[$current_cell_ref]['end'] = $this->Xls_row;
  852.          $this->proprietarios_nome html_entity_decode($this->proprietarios_nomeENT_COMPAT$_SESSION['scriptcase']['charset']);
  853.          $this->proprietarios_nome strip_tags($this->proprietarios_nome);
  854.          if (!NM_is_utf8($this->proprietarios_nome))
  855.          {
  856.              $this->proprietarios_nome sc_convert_encoding($this->proprietarios_nome"UTF-8"$_SESSION['scriptcase']['charset']);
  857.          }
  858.          if ($this->Use_phpspreadsheet) {
  859.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->proprietarios_nome, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
  860.          }
  861.          else {
  862.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->proprietarios_nomePHPExcel_Cell_DataType::TYPE_STRING);
  863.          }
  864.          $this->Xls_col++;
  865.    }
  866.    //----- proprietarios_sexo
  867.    function NM_export_proprietarios_sexo()
  868.    {
  869.          $current_cell_ref $this->calc_cell($this->Xls_col);
  870.          if (!isset($this->NM_ctrl_style[$current_cell_ref])) {
  871.              $this->NM_ctrl_style[$current_cell_ref]['ini'] = $this->Xls_row;
  872.              $this->NM_ctrl_style[$current_cell_ref]['align'] = "LEFT"
  873.          }
  874.          $this->NM_ctrl_style[$current_cell_ref]['end'] = $this->Xls_row;
  875.          $this->proprietarios_sexo html_entity_decode($this->proprietarios_sexoENT_COMPAT$_SESSION['scriptcase']['charset']);
  876.          $this->proprietarios_sexo strip_tags($this->proprietarios_sexo);
  877.          if (!NM_is_utf8($this->proprietarios_sexo))
  878.          {
  879.              $this->proprietarios_sexo sc_convert_encoding($this->proprietarios_sexo"UTF-8"$_SESSION['scriptcase']['charset']);
  880.          }
  881.          if ($this->Use_phpspreadsheet) {
  882.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->proprietarios_sexo, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
  883.          }
  884.          else {
  885.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->proprietarios_sexoPHPExcel_Cell_DataType::TYPE_STRING);
  886.          }
  887.          $this->Xls_col++;
  888.    }
  889.    //----- proprietarios_cpf
  890.    function NM_export_proprietarios_cpf()
  891.    {
  892.          $current_cell_ref $this->calc_cell($this->Xls_col);
  893.          if (!isset($this->NM_ctrl_style[$current_cell_ref])) {
  894.              $this->NM_ctrl_style[$current_cell_ref]['ini'] = $this->Xls_row;
  895.              $this->NM_ctrl_style[$current_cell_ref]['align'] = "RIGHT"
  896.          }
  897.          $this->NM_ctrl_style[$current_cell_ref]['end'] = $this->Xls_row;
  898.          if (!NM_is_utf8($this->proprietarios_cpf))
  899.          {
  900.              $this->proprietarios_cpf sc_convert_encoding($this->proprietarios_cpf"UTF-8"$_SESSION['scriptcase']['charset']);
  901.          }
  902.          if (is_numeric($this->proprietarios_cpf))
  903.          {
  904.              $this->NM_ctrl_style[$current_cell_ref]['format'] = '#,##0';
  905.          }
  906.          $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$this->proprietarios_cpf);
  907.          $this->Xls_col++;
  908.    }
  909.    //----- proprietarios_telefone
  910.    function NM_export_proprietarios_telefone()
  911.    {
  912.          $current_cell_ref $this->calc_cell($this->Xls_col);
  913.          if (!isset($this->NM_ctrl_style[$current_cell_ref])) {
  914.              $this->NM_ctrl_style[$current_cell_ref]['ini'] = $this->Xls_row;
  915.              $this->NM_ctrl_style[$current_cell_ref]['align'] = "LEFT"
  916.          }
  917.          $this->NM_ctrl_style[$current_cell_ref]['end'] = $this->Xls_row;
  918.          $this->proprietarios_telefone html_entity_decode($this->proprietarios_telefoneENT_COMPAT$_SESSION['scriptcase']['charset']);
  919.          $this->proprietarios_telefone strip_tags($this->proprietarios_telefone);
  920.          if (!NM_is_utf8($this->proprietarios_telefone))
  921.          {
  922.              $this->proprietarios_telefone sc_convert_encoding($this->proprietarios_telefone"UTF-8"$_SESSION['scriptcase']['charset']);
  923.          }
  924.          if ($this->Use_phpspreadsheet) {
  925.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->proprietarios_telefone, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
  926.          }
  927.          else {
  928.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->proprietarios_telefonePHPExcel_Cell_DataType::TYPE_STRING);
  929.          }
  930.          $this->Xls_col++;
  931.    }
  932.    //----- veiculos_idveiculos
  933.    function NM_export_veiculos_idveiculos()
  934.    {
  935.          $current_cell_ref $this->calc_cell($this->Xls_col);
  936.          if (!isset($this->NM_ctrl_style[$current_cell_ref])) {
  937.              $this->NM_ctrl_style[$current_cell_ref]['ini'] = $this->Xls_row;
  938.              $this->NM_ctrl_style[$current_cell_ref]['align'] = "RIGHT"
  939.          }
  940.          $this->NM_ctrl_style[$current_cell_ref]['end'] = $this->Xls_row;
  941.          if (!NM_is_utf8($this->veiculos_idveiculos))
  942.          {
  943.              $this->veiculos_idveiculos sc_convert_encoding($this->veiculos_idveiculos"UTF-8"$_SESSION['scriptcase']['charset']);
  944.          }
  945.          if (is_numeric($this->veiculos_idveiculos))
  946.          {
  947.              $this->NM_ctrl_style[$current_cell_ref]['format'] = '#,##0';
  948.          }
  949.          $this->Nm_ActiveSheet->setCellValue($current_cell_ref $this->Xls_row$this->veiculos_idveiculos);
  950.          $this->Xls_col++;
  951.    }
  952.    //----- veiculos_anomodelo
  953.    function NM_export_veiculos_anomodelo()
  954.    {
  955.          $current_cell_ref $this->calc_cell($this->Xls_col);
  956.          if (!isset($this->NM_ctrl_style[$current_cell_ref])) {
  957.              $this->NM_ctrl_style[$current_cell_ref]['ini'] = $this->Xls_row;
  958.              $this->NM_ctrl_style[$current_cell_ref]['align'] = "LEFT"
  959.          }
  960.          $this->NM_ctrl_style[$current_cell_ref]['end'] = $this->Xls_row;
  961.          $this->veiculos_anomodelo html_entity_decode($this->veiculos_anomodeloENT_COMPAT$_SESSION['scriptcase']['charset']);
  962.          $this->veiculos_anomodelo strip_tags($this->veiculos_anomodelo);
  963.          if (!NM_is_utf8($this->veiculos_anomodelo))
  964.          {
  965.              $this->veiculos_anomodelo sc_convert_encoding($this->veiculos_anomodelo"UTF-8"$_SESSION['scriptcase']['charset']);
  966.          }
  967.          if ($this->Use_phpspreadsheet) {
  968.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->veiculos_anomodelo, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
  969.          }
  970.          else {
  971.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->veiculos_anomodeloPHPExcel_Cell_DataType::TYPE_STRING);
  972.          }
  973.          $this->Xls_col++;
  974.    }
  975.    //----- veiculos_placa
  976.    function NM_export_veiculos_placa()
  977.    {
  978.          $current_cell_ref $this->calc_cell($this->Xls_col);
  979.          if (!isset($this->NM_ctrl_style[$current_cell_ref])) {
  980.              $this->NM_ctrl_style[$current_cell_ref]['ini'] = $this->Xls_row;
  981.              $this->NM_ctrl_style[$current_cell_ref]['align'] = "LEFT"
  982.          }
  983.          $this->NM_ctrl_style[$current_cell_ref]['end'] = $this->Xls_row;
  984.          $this->veiculos_placa html_entity_decode($this->veiculos_placaENT_COMPAT$_SESSION['scriptcase']['charset']);
  985.          $this->veiculos_placa strip_tags($this->veiculos_placa);
  986.          if (!NM_is_utf8($this->veiculos_placa))
  987.          {
  988.              $this->veiculos_placa sc_convert_encoding($this->veiculos_placa"UTF-8"$_SESSION['scriptcase']['charset']);
  989.          }
  990.          if ($this->Use_phpspreadsheet) {
  991.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->veiculos_placa, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
  992.          }
  993.          else {
  994.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->veiculos_placaPHPExcel_Cell_DataType::TYPE_STRING);
  995.          }
  996.          $this->Xls_col++;
  997.    }
  998.    //----- proprietarios_endereco
  999.    function NM_export_proprietarios_endereco()
  1000.    {
  1001.          $current_cell_ref $this->calc_cell($this->Xls_col);
  1002.          if (!isset($this->NM_ctrl_style[$current_cell_ref])) {
  1003.              $this->NM_ctrl_style[$current_cell_ref]['ini'] = $this->Xls_row;
  1004.              $this->NM_ctrl_style[$current_cell_ref]['align'] = "LEFT"
  1005.          }
  1006.          $this->NM_ctrl_style[$current_cell_ref]['end'] = $this->Xls_row;
  1007.          $this->proprietarios_endereco html_entity_decode($this->proprietarios_enderecoENT_COMPAT$_SESSION['scriptcase']['charset']);
  1008.          $this->proprietarios_endereco strip_tags($this->proprietarios_endereco);
  1009.          if (!NM_is_utf8($this->proprietarios_endereco))
  1010.          {
  1011.              $this->proprietarios_endereco sc_convert_encoding($this->proprietarios_endereco"UTF-8"$_SESSION['scriptcase']['charset']);
  1012.          }
  1013.          if ($this->Use_phpspreadsheet) {
  1014.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->proprietarios_endereco, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);
  1015.          }
  1016.          else {
  1017.              $this->Nm_ActiveSheet->setCellValueExplicit($current_cell_ref $this->Xls_row$this->proprietarios_enderecoPHPExcel_Cell_DataType::TYPE_STRING);
  1018.          }
  1019.          $this->Xls_col++;
  1020.    }
  1021.    //----- proprietarios_idproprietario
  1022.    function NM_sub_cons_proprietarios_idproprietario()
  1023.    {
  1024.          if (!NM_is_utf8($this->proprietarios_idproprietario))
  1025.          {
  1026.              $this->proprietarios_idproprietario sc_convert_encoding($this->proprietarios_idproprietario"UTF-8"$_SESSION['scriptcase']['charset']);
  1027.          }
  1028.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['data']   = $this->proprietarios_idproprietario;
  1029.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['align']  = "right";
  1030.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['type']   = "num";
  1031.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['format'] = "#,##0";
  1032.          $this->Xls_col++;
  1033.    }
  1034.    //----- proprietarios_nome
  1035.    function NM_sub_cons_proprietarios_nome()
  1036.    {
  1037.          $this->proprietarios_nome html_entity_decode($this->proprietarios_nomeENT_COMPAT$_SESSION['scriptcase']['charset']);
  1038.          $this->proprietarios_nome strip_tags($this->proprietarios_nome);
  1039.          if (!NM_is_utf8($this->proprietarios_nome))
  1040.          {
  1041.              $this->proprietarios_nome sc_convert_encoding($this->proprietarios_nome"UTF-8"$_SESSION['scriptcase']['charset']);
  1042.          }
  1043.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['data']   = $this->proprietarios_nome;
  1044.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['align']  = "left";
  1045.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['type']   = "char";
  1046.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['format'] = "";
  1047.          $this->Xls_col++;
  1048.    }
  1049.    //----- proprietarios_sexo
  1050.    function NM_sub_cons_proprietarios_sexo()
  1051.    {
  1052.          $this->proprietarios_sexo html_entity_decode($this->proprietarios_sexoENT_COMPAT$_SESSION['scriptcase']['charset']);
  1053.          $this->proprietarios_sexo strip_tags($this->proprietarios_sexo);
  1054.          if (!NM_is_utf8($this->proprietarios_sexo))
  1055.          {
  1056.              $this->proprietarios_sexo sc_convert_encoding($this->proprietarios_sexo"UTF-8"$_SESSION['scriptcase']['charset']);
  1057.          }
  1058.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['data']   = $this->proprietarios_sexo;
  1059.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['align']  = "left";
  1060.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['type']   = "char";
  1061.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['format'] = "";
  1062.          $this->Xls_col++;
  1063.    }
  1064.    //----- proprietarios_cpf
  1065.    function NM_sub_cons_proprietarios_cpf()
  1066.    {
  1067.          if (!NM_is_utf8($this->proprietarios_cpf))
  1068.          {
  1069.              $this->proprietarios_cpf sc_convert_encoding($this->proprietarios_cpf"UTF-8"$_SESSION['scriptcase']['charset']);
  1070.          }
  1071.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['data']   = $this->proprietarios_cpf;
  1072.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['align']  = "right";
  1073.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['type']   = "num";
  1074.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['format'] = "#,##0";
  1075.          $this->Xls_col++;
  1076.    }
  1077.    //----- proprietarios_telefone
  1078.    function NM_sub_cons_proprietarios_telefone()
  1079.    {
  1080.          $this->proprietarios_telefone html_entity_decode($this->proprietarios_telefoneENT_COMPAT$_SESSION['scriptcase']['charset']);
  1081.          $this->proprietarios_telefone strip_tags($this->proprietarios_telefone);
  1082.          if (!NM_is_utf8($this->proprietarios_telefone))
  1083.          {
  1084.              $this->proprietarios_telefone sc_convert_encoding($this->proprietarios_telefone"UTF-8"$_SESSION['scriptcase']['charset']);
  1085.          }
  1086.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['data']   = $this->proprietarios_telefone;
  1087.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['align']  = "left";
  1088.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['type']   = "char";
  1089.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['format'] = "";
  1090.          $this->Xls_col++;
  1091.    }
  1092.    //----- veiculos_idveiculos
  1093.    function NM_sub_cons_veiculos_idveiculos()
  1094.    {
  1095.          if (!NM_is_utf8($this->veiculos_idveiculos))
  1096.          {
  1097.              $this->veiculos_idveiculos sc_convert_encoding($this->veiculos_idveiculos"UTF-8"$_SESSION['scriptcase']['charset']);
  1098.          }
  1099.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['data']   = $this->veiculos_idveiculos;
  1100.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['align']  = "right";
  1101.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['type']   = "num";
  1102.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['format'] = "#,##0";
  1103.          $this->Xls_col++;
  1104.    }
  1105.    //----- veiculos_anomodelo
  1106.    function NM_sub_cons_veiculos_anomodelo()
  1107.    {
  1108.          $this->veiculos_anomodelo html_entity_decode($this->veiculos_anomodeloENT_COMPAT$_SESSION['scriptcase']['charset']);
  1109.          $this->veiculos_anomodelo strip_tags($this->veiculos_anomodelo);
  1110.          if (!NM_is_utf8($this->veiculos_anomodelo))
  1111.          {
  1112.              $this->veiculos_anomodelo sc_convert_encoding($this->veiculos_anomodelo"UTF-8"$_SESSION['scriptcase']['charset']);
  1113.          }
  1114.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['data']   = $this->veiculos_anomodelo;
  1115.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['align']  = "left";
  1116.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['type']   = "char";
  1117.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['format'] = "";
  1118.          $this->Xls_col++;
  1119.    }
  1120.    //----- veiculos_placa
  1121.    function NM_sub_cons_veiculos_placa()
  1122.    {
  1123.          $this->veiculos_placa html_entity_decode($this->veiculos_placaENT_COMPAT$_SESSION['scriptcase']['charset']);
  1124.          $this->veiculos_placa strip_tags($this->veiculos_placa);
  1125.          if (!NM_is_utf8($this->veiculos_placa))
  1126.          {
  1127.              $this->veiculos_placa sc_convert_encoding($this->veiculos_placa"UTF-8"$_SESSION['scriptcase']['charset']);
  1128.          }
  1129.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['data']   = $this->veiculos_placa;
  1130.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['align']  = "left";
  1131.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['type']   = "char";
  1132.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['format'] = "";
  1133.          $this->Xls_col++;
  1134.    }
  1135.    //----- proprietarios_endereco
  1136.    function NM_sub_cons_proprietarios_endereco()
  1137.    {
  1138.          $this->proprietarios_endereco html_entity_decode($this->proprietarios_enderecoENT_COMPAT$_SESSION['scriptcase']['charset']);
  1139.          $this->proprietarios_endereco strip_tags($this->proprietarios_endereco);
  1140.          if (!NM_is_utf8($this->proprietarios_endereco))
  1141.          {
  1142.              $this->proprietarios_endereco sc_convert_encoding($this->proprietarios_endereco"UTF-8"$_SESSION['scriptcase']['charset']);
  1143.          }
  1144.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['data']   = $this->proprietarios_endereco;
  1145.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['align']  = "left";
  1146.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['type']   = "char";
  1147.          $this->arr_export['lines'][$this->Xls_row][$this->Xls_col]['format'] = "";
  1148.          $this->Xls_col++;
  1149.    }
  1150.    function xls_sub_cons_copy_label($row)
  1151.    {
  1152.        if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['nolabel']) || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['nolabel'])
  1153.        {
  1154.            foreach ($this->arr_export['label'] as $col => $dados)
  1155.            {
  1156.                $this->arr_export['lines'][$row][$col] = $dados;
  1157.            }
  1158.        }
  1159.    }
  1160.    function xls_set_style()
  1161.    {
  1162.        if (!empty($this->NM_ctrl_style))
  1163.        {
  1164.            foreach ($this->NM_ctrl_style as $col => $dados)
  1165.            {
  1166.                $cell_ref $col $dados['ini'] . ":" $col $dados['end'];
  1167.                if ($this->Use_phpspreadsheet) {
  1168.                    if ($dados['align'] == "LEFT") {
  1169.                        $this->Nm_ActiveSheet->getStyle($cell_ref)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
  1170.                    }
  1171.                    elseif ($dados['align'] == "RIGHT") {
  1172.                        $this->Nm_ActiveSheet->getStyle($cell_ref)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT);
  1173.                    }
  1174.                    else {
  1175.                        $this->Nm_ActiveSheet->getStyle($cell_ref)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
  1176.                    }
  1177.                }
  1178.                else {
  1179.                    if ($dados['align'] == "LEFT") {
  1180.                        $this->Nm_ActiveSheet->getStyle($cell_ref)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
  1181.                    }
  1182.                    elseif ($dados['align'] == "RIGHT") {
  1183.                        $this->Nm_ActiveSheet->getStyle($cell_ref)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
  1184.                    }
  1185.                    else {
  1186.                        $this->Nm_ActiveSheet->getStyle($cell_ref)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
  1187.                    }
  1188.                }
  1189.                if (isset($dados['format'])) {
  1190.                    $this->Nm_ActiveSheet->getStyle($cell_ref)->getNumberFormat()->setFormatCode($dados['format']);
  1191.                }
  1192.            }
  1193.            $this->NM_ctrl_style = array();
  1194.        }
  1195.    }
  1196.    function quebra_geral_sc_free_total_bot() 
  1197.    {
  1198.    }

  1199.    function calc_cell($col)
  1200.    {
  1201.        $arr_alfa = array("","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
  1202.        $val_ret "";
  1203.        $result $col 1;
  1204.        while ($result 26)
  1205.        {
  1206.            $cel      $result 26;
  1207.            $result   $result 26;
  1208.            if ($cel == 0)
  1209.            {
  1210.                $cel    26;
  1211.                $result--;
  1212.            }
  1213.            $val_ret $arr_alfa[$cel] . $val_ret;
  1214.        }
  1215.        $val_ret $arr_alfa[$result] . $val_ret;
  1216.        return $val_ret;
  1217.    }

  1218.    function nm_conv_data_db($dt_in$form_in$form_out)
  1219.    {
  1220.        $dt_out $dt_in;
  1221.        if (strtoupper($form_in) == "DB_FORMAT")
  1222.        {
  1223.            if ($dt_out == "null" || $dt_out == "")
  1224.            {
  1225.                $dt_out "";
  1226.                return $dt_out;
  1227.            }
  1228.            $form_in "AAAA-MM-DD";
  1229.        }
  1230.        if (strtoupper($form_out) == "DB_FORMAT")
  1231.        {
  1232.            if (empty($dt_out))
  1233.            {
  1234.                $dt_out "null";
  1235.                return $dt_out;
  1236.            }
  1237.            $form_out "AAAA-MM-DD";
  1238.        }
  1239.        nm_conv_form_data($dt_out$form_in$form_out);
  1240.        return $dt_out;
  1241.    }
  1242.    function progress_bar_end()
  1243.    {
  1244.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_file']);
  1245.       if (is_file($this->Xls_f))
  1246.       {
  1247.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_file'] = $this->Xls_f;
  1248.       }
  1249.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  1250.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  1251.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  1252.       $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  1253.       if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  1254.           $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  1255.       }
  1256.       $this->pb->setProgressbarMessage($Mens_bar);
  1257.       $this->pb->setDownloadLink($this->Ini->path_imag_temp "/" $this->Arquivo);
  1258.       $this->pb->setDownloadMd5($path_doc_md5);
  1259.       $this->pb->completed();
  1260.    }
  1261.    //---- 
  1262.    function monta_html()
  1263.    {
  1264.       global $nm_url_saida$nm_lang;
  1265.       include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  1266.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_file']);
  1267.       if (is_file($this->Xls_f))
  1268.       {
  1269.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_file'] = $this->Xls_f;
  1270.       }
  1271.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  1272.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  1273.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  1274. ?>
  1275. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  1276.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  1277. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  1278. <HEAD>
  1279.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: Excel</TITLE>
  1280.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  1281. <?php
  1282. if ($_SESSION['scriptcase']['proc_mobile'])
  1283. {
  1284. ?>
  1285.   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  1286. <?php
  1287. }
  1288. ?>
  1289.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  1290.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  1291.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  1292.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  1293.  <META http-equiv="Pragma" content="no-cache"/>
  1294.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  1295.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  1296.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  1297.  <?php
  1298.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  1299.  {
  1300.  ?>
  1301.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  1302.  <?php
  1303.  }
  1304.  ?>
  1305.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  1306. </HEAD>
  1307. <BODY class="scExportPage">
  1308. <?php echo $this->Ini->Ajax_result_set ?>
  1309. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  1310.  <table class="scExportTable" align="center">
  1311.   <tr>
  1312.    <td class="scExportTitle" style="height: 25px">XLS</td>
  1313.   </tr>
  1314.   <tr>
  1315.    <td class="scExportLine" style="width: 100%">
  1316.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  1317.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  1318.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  1319.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  1320.  ?>
  1321.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  1322.  ?>
  1323.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  1324.  ?>
  1325.     </td></tr></table>
  1326.    </td>
  1327.   </tr>
  1328.  </table>
  1329. </td></tr></table>
  1330. <form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp "/" $this->Arquivo ?>" target="_blank" style="display: none"> 
  1331. </form>
  1332. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  1333. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  1334. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  1335. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  1336. </form>
  1337. <FORM name="F0" method=post action="./"> 
  1338. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  1339. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  1340. <INPUT type="hidden" name="nmgp_opcao" value="<?php echo NM_encode_input($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_return']); ?>"> 
  1341. </FORM> 
  1342. </BODY>
  1343. </HTML>
  1344. <?php
  1345.    }
  1346.    function nm_gera_mask(&$nm_campo$nm_mask)
  1347.    { 
  1348.       $trab_campo $nm_campo;
  1349.       $trab_mask  $nm_mask;
  1350.       $tam_campo  strlen($nm_campo);
  1351.       $trab_saida "";
  1352.       $mask_num false;
  1353.       for ($x=0$x strlen($trab_mask); $x++)
  1354.       {
  1355.           if (substr($trab_mask$x1) == "#")
  1356.           {
  1357.               $mask_num true;
  1358.               break;
  1359.           }
  1360.       }
  1361.       if ($mask_num )
  1362.       {
  1363.           $ver_duas explode(";"$trab_mask);
  1364.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  1365.           {
  1366.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  1367.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  1368.               if ($cont2 >= $tam_campo)
  1369.               {
  1370.                   $trab_mask $ver_duas[1];
  1371.               }
  1372.               else
  1373.               {
  1374.                   $trab_mask $ver_duas[0];
  1375.               }
  1376.           }
  1377.           $tam_mask strlen($trab_mask);
  1378.           $xdados 0;
  1379.           for ($x=0$x $tam_mask$x++)
  1380.           {
  1381.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  1382.               {
  1383.                   $trab_saida .= substr($trab_campo$xdados1);
  1384.                   $xdados++;
  1385.               }
  1386.               elseif ($xdados $tam_campo)
  1387.               {
  1388.                   $trab_saida .= substr($trab_mask$x1);
  1389.               }
  1390.           }
  1391.           if ($xdados $tam_campo)
  1392.           {
  1393.               $trab_saida .= substr($trab_campo$xdados);
  1394.           }
  1395.           $nm_campo $trab_saida;
  1396.           return;
  1397.       }
  1398.       for ($ix strlen($trab_mask); $ix 0$ix--)
  1399.       {
  1400.            $char_mask substr($trab_mask$ix 11);
  1401.            if ($char_mask != "x" && $char_mask != "z")
  1402.            {
  1403.                $trab_saida $char_mask $trab_saida;
  1404.            }
  1405.            else
  1406.            {
  1407.                if ($tam_campo != 0)
  1408.                {
  1409.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  1410.                    $tam_campo--;
  1411.                }
  1412.                else
  1413.                {
  1414.                    $trab_saida "0" $trab_saida;
  1415.                }
  1416.            }
  1417.       }
  1418.       if ($tam_campo != 0)
  1419.       {
  1420.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  1421.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  1422.       }
  1423.    
  1424.       $iz 0
  1425.       for ($ix 0$ix strlen($trab_mask); $ix++)
  1426.       {
  1427.            $char_mask substr($trab_mask$ix1);
  1428.            if ($char_mask != "x" && $char_mask != "z")
  1429.            {
  1430.                if ($char_mask == "." || $char_mask == ",")
  1431.                {
  1432.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  1433.                }
  1434.                else
  1435.                {
  1436.                    $iz++;
  1437.                }
  1438.            }
  1439.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  1440.            {
  1441.                $ix strlen($trab_mask) + 1;
  1442.            }
  1443.            else
  1444.            {
  1445.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  1446.            }
  1447.       }
  1448.       $nm_campo $trab_saida;
  1449.    } 
  1450. }

  1451. ?>
Return
grid_new_xml.class.php
  1. <?php

  2. class grid_new_xml
  3. {
  4.    var $Db;
  5.    var $Erro;
  6.    var $Ini;
  7.    var $Lookup;
  8.    var $nm_data;

  9.    var $Arquivo;
  10.    var $Arquivo_view;
  11.    var $Tit_doc;
  12.    var $sc_proc_grid
  13.    var $NM_cmp_hidden = array();
  14.    var $count_ger;

  15.    //---- 
  16.    function __construct()
  17.    {
  18.       $this->nm_data   = new nm_data("en_us");
  19.    }

  20.    //---- 
  21.    function monta_xml()
  22.    {
  23.       $this->inicializa_vars();
  24.       $this->grava_arquivo();
  25.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  26.       {
  27.           if ($this->Ini->sc_export_ajax)
  28.           {
  29.               $this->Arr_result['file_export']  = NM_charset_to_utf8($this->Xml_f);
  30.               $this->Arr_result['title_export'] = NM_charset_to_utf8($this->Tit_doc);
  31.               $Temp ob_get_clean();
  32.               if ($Temp !== false && trim($Temp) != "")
  33.               {
  34.                   $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  35.               }
  36.               $oJson = new Services_JSON();
  37.               echo $oJson->encode($this->Arr_result);
  38.               exit;
  39.           }
  40.           else
  41.           {
  42.               $this->progress_bar_end();
  43.           }
  44.       }
  45.       else
  46.       {
  47.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "";
  48.       }
  49.    }

  50.    //----- 
  51.    function inicializa_vars()
  52.    {
  53.       global $nm_lang;
  54.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  55.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  56.       $this->New_Format  true;
  57.       $this->Xml_tag_label true;
  58.       $this->Tem_xml_res false;
  59.       $this->Xml_password "";
  60.       if (isset($_REQUEST['nm_xml_tag']) && !empty($_REQUEST['nm_xml_tag']))
  61.       {
  62.           $this->New_Format = ($_REQUEST['nm_xml_tag'] == "tag") ? true false;
  63.       }
  64.       if (isset($_REQUEST['nm_xml_label']) && !empty($_REQUEST['nm_xml_label']))
  65.       {
  66.           $this->Xml_tag_label = ($_REQUEST['nm_xml_label'] == "S") ? true false;
  67.       }
  68.       $this->Tem_xml_res  true;
  69.       if (isset($_REQUEST['SC_module_export']) && $_REQUEST['SC_module_export'] != "")
  70.       { 
  71.           $this->Tem_xml_res = (strpos(" " $_REQUEST['SC_module_export'], "resume") !== false) ? true false;
  72.       } 
  73.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total")
  74.       {
  75.           $this->Tem_xml_res  false;
  76.       }
  77.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_group_by" && empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  78.       {
  79.           $this->Tem_xml_res  false;
  80.       }
  81.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_label']))
  82.       {
  83.           $this->Xml_tag_label $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_label'];
  84.           $this->New_Format    true;
  85.       }
  86.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  87.       require_once($this->Ini->path_aplicacao "grid_new_total.class.php"); 
  88.       $this->Tot      = new grid_new_total($this->Ini->sc_page);
  89.       $this->prep_modulos("Tot");
  90.       $Gb_geral "quebra_geral_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'];
  91.       if (method_exists($this->Tot,$Gb_geral))
  92.       {
  93.           $this->Tot->$Gb_geral();
  94.           $this->count_ger $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral'][1];
  95.       }
  96.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && !$this->Ini->sc_export_ajax) {
  97.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  98.           $this->pb = new scProgressBar();
  99.           $this->pb->setRoot($this->Ini->root);
  100.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  101.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  102.           $this->pb->initialize();
  103.           $this->pb->setReturnUrl("./");
  104.           $this->pb->setReturnOption($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_return']);
  105.           if ($this->Tem_xml_res) {
  106.               $PB_plus intval ($this->count_ger 0.04);
  107.               $PB_plus = ($PB_plus 2) ? $PB_plus;
  108.           }
  109.           else {
  110.               $PB_plus intval ($this->count_ger 0.02);
  111.               $PB_plus = ($PB_plus 1) ? $PB_plus;
  112.           }
  113.           $PB_tot $this->count_ger $PB_plus;
  114.           $this->PB_dif $PB_tot $this->count_ger;
  115.           $this->pb->setTotalSteps($PB_tot);
  116.       }
  117.       $this->nm_data    = new nm_data("en_us");
  118.       $this->Arquivo      "sc_xml";
  119.       $this->Arquivo     .= "_" date("YmdHis") . "_" rand(01000);
  120.       $this->Arq_zip      $this->Arquivo "_grid_new.zip";
  121.       $this->Arquivo     .= "_grid_new";
  122.       $this->Arquivo_view $this->Arquivo "_view.xml";
  123.       $this->Arquivo     .= ".xml";
  124.       $this->Tit_doc      "grid_new.xml";
  125.       $this->Tit_zip      "grid_new.zip";
  126.       $this->Grava_view   false;
  127.       if (strtolower($_SESSION['scriptcase']['charset']) != strtolower($_SESSION['scriptcase']['charset_html']))
  128.       {
  129.           $this->Grava_view true;
  130.       }
  131.    }

  132.    //---- 
  133.    function prep_modulos($modulo)
  134.    {
  135.       $this->$modulo->Ini    $this->Ini;
  136.       $this->$modulo->Db     $this->Db;
  137.       $this->$modulo->Erro   $this->Erro;
  138.       $this->$modulo->Lookup $this->Lookup;
  139.    }

  140.    //----- 
  141.    function grava_arquivo()
  142.    {
  143.       global $nm_lang;
  144.       global $nm_nada$nm_lang;

  145.       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''
  146.       $this->sc_proc_grid false
  147.       $nm_raiz_img  ""
  148.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name']))
  149.       {
  150.           $this->Arquivo $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'];
  151.           $this->Arq_zip $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'];
  152.           $this->Tit_doc $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'];
  153.           $Pos strrpos($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'], ".");
  154.           if ($Pos !== false) {
  155.               $this->Arq_zip substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name'], 0$Pos);
  156.           }
  157.           $this->Arq_zip .= ".zip";
  158.           $this->Tit_zip  $this->Arq_zip;
  159.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_name']);
  160.       }
  161.       if (!$this->Grava_view)
  162.       {
  163.           $this->Arquivo_view $this->Arquivo;
  164.       }
  165.       if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display']))
  166.       {
  167.           foreach ($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['field_display'] as $NM_cada_field => $NM_cada_opc)
  168.           {
  169.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  170.           }
  171.       }
  172.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']))
  173.       {
  174.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  175.           {
  176.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  177.           }
  178.       }
  179.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel']))
  180.       {
  181.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['php_cmp_sel'] as $NM_cada_field => $NM_cada_opc)
  182.           {
  183.               $this->NM_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
  184.           }
  185.       }
  186.       $this->sc_where_orig   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];
  187.       $this->sc_where_atual  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  188.       $this->sc_where_filtro $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'];
  189.       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca']))
  190.       { 
  191.           $Busca_temp $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'];
  192.           if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  193.           {
  194.               $Busca_temp NM_conv_charset($Busca_temp$_SESSION['scriptcase']['charset'], "UTF-8");
  195.           }
  196.           $this->proprietarios_idproprietario $Busca_temp['proprietarios_idproprietario']; 
  197.           $tmp_pos strpos($this->proprietarios_idproprietario"##@@");
  198.           if ($tmp_pos !== false && !is_array($this->proprietarios_idproprietario))
  199.           {
  200.               $this->proprietarios_idproprietario substr($this->proprietarios_idproprietario0$tmp_pos);
  201.           }
  202.           $this->proprietarios_nome $Busca_temp['proprietarios_nome']; 
  203.           $tmp_pos strpos($this->proprietarios_nome"##@@");
  204.           if ($tmp_pos !== false && !is_array($this->proprietarios_nome))
  205.           {
  206.               $this->proprietarios_nome substr($this->proprietarios_nome0$tmp_pos);
  207.           }
  208.           $this->proprietarios_sexo $Busca_temp['proprietarios_sexo']; 
  209.           $tmp_pos strpos($this->proprietarios_sexo"##@@");
  210.           if ($tmp_pos !== false && !is_array($this->proprietarios_sexo))
  211.           {
  212.               $this->proprietarios_sexo substr($this->proprietarios_sexo0$tmp_pos);
  213.           }
  214.           $this->proprietarios_cpf $Busca_temp['proprietarios_cpf']; 
  215.           $tmp_pos strpos($this->proprietarios_cpf"##@@");
  216.           if ($tmp_pos !== false && !is_array($this->proprietarios_cpf))
  217.           {
  218.               $this->proprietarios_cpf substr($this->proprietarios_cpf0$tmp_pos);
  219.           }
  220.       } 
  221.       $this->arr_export = array('label' => array(), 'lines' => array());
  222.       $this->arr_span   = array();

  223.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  224.       { 
  225.           $xml_charset $_SESSION['scriptcase']['charset'];
  226.           $this->Xml_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  227.           $this->Zip_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arq_zip;
  228.           $xml_f fopen($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo"w");
  229.           fwrite($xml_f"<?xml version=\"1.0\" encoding=\"$xml_charset\" ?>\r\n");
  230.           fwrite($xml_f"<root>\r\n");
  231.           if ($this->Grava_view)
  232.           {
  233.               $xml_charset_v $_SESSION['scriptcase']['charset_html'];
  234.               $xml_v         fopen($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo_view"w");
  235.               fwrite($xml_v"<?xml version=\"1.0\" encoding=\"$xml_charset_v\" ?>\r\n");
  236.               fwrite($xml_v"<root>\r\n");
  237.           }
  238.       }
  239.       $this->nm_field_dinamico = array();
  240.       $this->nm_order_dinamico = array();
  241.       $nmgp_select_count "SELECT count(*) AS countTest from " $this->Ini->nm_tabela
  242.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
  243.       { 
  244.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  245.       } 
  246.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
  247.       { 
  248.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  249.       } 
  250.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
  251.       { 
  252.        $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  253.       } 
  254.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
  255.       { 
  256.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  257.       } 
  258.       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
  259.       { 
  260.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  261.       } 
  262.       else 
  263.       { 
  264.           $nmgp_select "SELECT Proprietarios.idProprietario as proprietarios_idproprietario, Proprietarios.Nome as proprietarios_nome, Proprietarios.Sexo as proprietarios_sexo, Proprietarios.Cpf as proprietarios_cpf, Proprietarios.Telefone as proprietarios_telefone, Veiculos.idVeiculos as veiculos_idveiculos, Veiculos.AnoModelo as veiculos_anomodelo, Veiculos.Placa as veiculos_placa, Proprietarios.Endereco as proprietarios_endereco from " $this->Ini->nm_tabela
  265.       } 
  266.       $nmgp_select .= " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  267.       $nmgp_select_count .= " " $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  268.       $nmgp_order_by $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['order_grid'];
  269.       $nmgp_select .= $nmgp_order_by
  270.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select_count;
  271.       $rt $this->Db->Execute($nmgp_select_count);
  272.       if ($rt === false && !$rt->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1)
  273.       {
  274.          $this->Erro->mensagem(__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg());
  275.          exit;
  276.       }
  277.       $this->count_ger $rt->fields[0];
  278.       $rt->Close();
  279.       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select;
  280.       $rs $this->Db->Execute($nmgp_select);
  281.       if ($rs === false && !$rs->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1)
  282.       {
  283.          $this->Erro->mensagem(__FILE____LINE__"banco"$this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg());
  284.          exit;
  285.       }
  286.       $this->SC_seq_register 0;
  287.       $this->xml_registro "";
  288.       $PB_tot = (isset($this->count_ger) && $this->count_ger 0) ? "/" $this->count_ger "";
  289.       while (!$rs->EOF)
  290.       {
  291.          $this->SC_seq_register++;
  292.          if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && !$this->Ini->sc_export_ajax) {
  293.              $Mens_bar $this->Ini->Nm_lang['lang_othr_prcs'];
  294.              if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  295.                  $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  296.              }
  297.              $this->pb->setProgressbarMessage($Mens_bar ": " $this->SC_seq_register $PB_tot);
  298.              $this->pb->addSteps(1);
  299.          }
  300.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  301.          { 
  302.              $this->xml_registro .= "<" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_tit'] . ">\r\n";
  303.          }
  304.          elseif ($this->New_Format)
  305.          {
  306.              $this->xml_registro "<grid_new>\r\n";
  307.          }
  308.          else
  309.          {
  310.              $this->xml_registro "<grid_new";
  311.          }
  312.          $this->proprietarios_idproprietario $rs->fields[0] ;  
  313.          $this->proprietarios_idproprietario = (string)$this->proprietarios_idproprietario;
  314.          $this->proprietarios_nome $rs->fields[1] ;  
  315.          $this->proprietarios_sexo $rs->fields[2] ;  
  316.          $this->proprietarios_cpf $rs->fields[3] ;  
  317.          $this->proprietarios_cpf = (string)$this->proprietarios_cpf;
  318.          $this->proprietarios_telefone $rs->fields[4] ;  
  319.          $this->veiculos_idveiculos $rs->fields[5] ;  
  320.          $this->veiculos_idveiculos = (string)$this->veiculos_idveiculos;
  321.          $this->veiculos_anomodelo $rs->fields[6] ;  
  322.          $this->veiculos_placa $rs->fields[7] ;  
  323.          $this->proprietarios_endereco $rs->fields[8] ;  
  324.          $this->sc_proc_grid true
  325.          foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] as $Cada_col)
  326.          { 
  327.             if (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off")
  328.             { 
  329.                 $NM_func_exp "NM_export_" $Cada_col;
  330.                 $this->$NM_func_exp();
  331.             } 
  332.          } 
  333.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  334.          { 
  335.              $this->xml_registro .= "</" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_tit'] . ">\r\n";
  336.          }
  337.          elseif ($this->New_Format)
  338.          {
  339.              $this->xml_registro .= "</grid_new>\r\n";
  340.          }
  341.          else
  342.          {
  343.              $this->xml_registro .= " />\r\n";
  344.          }
  345.          if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  346.          { 
  347.              fwrite($xml_f$this->xml_registro);
  348.              if ($this->Grava_view)
  349.              {
  350.                 fwrite($xml_v$this->xml_registro);
  351.              }
  352.          }
  353.          $rs->MoveNext();
  354.       }
  355.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  356.       { 
  357.           if (!$this->New_Format)
  358.           {
  359.               $this->xml_registro "";
  360.           }
  361.           $_SESSION['scriptcase']['export_return'] = $this->xml_registro;
  362.       }
  363.       else
  364.       { 
  365.           fwrite($xml_f"</root>");
  366.           fclose($xml_f);
  367.           if ($this->Grava_view)
  368.           {
  369.              fwrite($xml_v"</root>");
  370.              fclose($xml_v);
  371.           }
  372.           if ($this->Tem_xml_res)
  373.           { 
  374.               if (!$this->Ini->sc_export_ajax) {
  375.                   $this->PB_dif intval ($this->PB_dif 2);
  376.                   $Mens_bar  $this->Ini->Nm_lang['lang_othr_prcs'];
  377.                   $Mens_smry $this->Ini->Nm_lang['lang_othr_smry_titl'];
  378.                   if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  379.                       $Mens_bar  sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  380.                       $Mens_smry sc_convert_encoding($Mens_smry"UTF-8"$_SESSION['scriptcase']['charset']);
  381.                   }
  382.                   $this->pb->setProgressbarMessage($Mens_bar ": " $Mens_smry);
  383.                   $this->pb->addSteps($this->PB_dif);
  384.               }
  385.               require_once($this->Ini->path_aplicacao "grid_new_res_xml.class.php");
  386.               $this->Res = new grid_new_res_xml();
  387.               $this->prep_modulos("Res");
  388.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_grid'] = true;
  389.               $this->Res->monta_xml();
  390.           } 
  391.           if (!$this->Ini->sc_export_ajax) {
  392.               $Mens_bar $this->Ini->Nm_lang['lang_btns_export_finished'];
  393.               if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  394.                   $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  395.               }
  396.               $this->pb->setProgressbarMessage($Mens_bar);
  397.               $this->pb->addSteps($this->PB_dif);
  398.           }
  399.           if ($this->Xml_password != "" || $this->Tem_xml_res)
  400.           { 
  401.               $str_zip    "";
  402.               $Parm_pass  = ($this->Xml_password != "") ? " -p" "";
  403.               $Zip_f      = (FALSE !== strpos($this->Zip_f' ')) ? " \"" $this->Zip_f "\"" :  $this->Zip_f;
  404.               $Arq_input  = (FALSE !== strpos($this->Xml_f' ')) ? " \"" $this->Xml_f "\"" :  $this->Xml_f;
  405.               if (is_file($Zip_f)) {
  406.                   unlink($Zip_f);
  407.               }
  408.               if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  409.               {
  410.                   chdir($this->Ini->path_third "/zip/windows");
  411.                   $str_zip "zip.exe " strtoupper($Parm_pass) . " -j " $this->Xml_password " " $Zip_f " " $Arq_input;
  412.               }
  413.               elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  414.               {
  415.                   if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  416.                   {
  417.                       chdir($this->Ini->path_third "/zip/linux-i386/bin");
  418.                   }
  419.                   else
  420.                   {
  421.                       chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  422.                   }
  423.                   $str_zip "./7za " $Parm_pass $this->Xml_password " a " $Zip_f " " $Arq_input;
  424.               }
  425.               elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  426.               {
  427.                   chdir($this->Ini->path_third "/zip/mac/bin");
  428.                   $str_zip "./7za " $Parm_pass $this->Xml_password " a " $Zip_f " " $Arq_input;
  429.               }
  430.               if (!empty($str_zip)) {
  431.                   exec($str_zip);
  432.               }
  433.               // ----- ZIP log
  434.               $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'w');
  435.               if ($fp)
  436.               {
  437.                   @fwrite($fp$str_zip "\r\n\r\n");
  438.                   @fclose($fp);
  439.               }
  440.               unlink($Arq_input);
  441.               $this->Arquivo $this->Arq_zip;
  442.               $this->Xml_f   $this->Zip_f;
  443.               $this->Tit_doc $this->Tit_zip;
  444.               if ($this->Tem_xml_res)
  445.               { 
  446.                   $str_zip   "";
  447.                   $Arq_res   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_file']['xml'];
  448.                   $Arq_input = (FALSE !== strpos($Arq_res' ')) ? " \"" $Arq_res "\"" :  $Arq_res;
  449.                   if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  450.                   {
  451.                       $str_zip "zip.exe " strtoupper($Parm_pass) . " -j -u " $this->Xml_password " " $Zip_f " " $Arq_input;
  452.                   }
  453.                   elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  454.                   {
  455.                       $str_zip "./7za " $Parm_pass $this->Xml_password " a " $Zip_f " " $Arq_input;
  456.                   }
  457.                   elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  458.                   {
  459.                       $str_zip "./7za " $Parm_pass $this->Xml_password " a " $Zip_f " " $Arq_input;
  460.                   }
  461.                   if (!empty($str_zip)) {
  462.                       exec($str_zip);
  463.                   }
  464.                   // ----- ZIP log
  465.                   $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'a');
  466.                   if ($fp)
  467.                   {
  468.                       @fwrite($fp$str_zip "\r\n\r\n");
  469.                       @fclose($fp);
  470.                   }
  471.                   unlink($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_file']['xml']);
  472.               }
  473.               if ($this->Grava_view)
  474.               {
  475.                   $str_zip    "";
  476.                   $xml_view_f $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo_view;
  477.                   $zip_view_f str_replace(".zip""_view.zip"$this->Zip_f);
  478.                   $zip_arq_v  str_replace(".zip""_view.zip"$this->Arq_zip);
  479.                   $Zip_f      = (FALSE !== strpos($zip_view_f' ')) ? " \"" $zip_view_f "\"" :  $zip_view_f;
  480.                   $Arq_input  = (FALSE !== strpos($xml_view_ff' ')) ? " \"" $xml_view_f "\"" :  $xml_view_f;
  481.                   if (is_file($Zip_f)) {
  482.                       unlink($Zip_f);
  483.                   }
  484.                   if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  485.                   {
  486.                       chdir($this->Ini->path_third "/zip/windows");
  487.                       $str_zip "zip.exe " strtoupper($Parm_pass) . " -j " $this->Xml_password " " $Zip_f " " $Arq_input;
  488.                   }
  489.                   elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  490.                   {
  491.                       if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  492.                       {
  493.                           chdir($this->Ini->path_third "/zip/linux-i386/bin");
  494.                       }
  495.                       else
  496.                       {
  497.                           chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  498.                       }
  499.                       $str_zip "./7za " $Parm_pass $this->Xml_password " a " $Zip_f " " $Arq_input;
  500.                   }
  501.                   elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  502.                   {
  503.                       chdir($this->Ini->path_third "/zip/mac/bin");
  504.                       $str_zip "./7za " $Parm_pass $this->Xml_password " a " $Zip_f " " $Arq_input;
  505.                   }
  506.                   if (!empty($str_zip)) {
  507.                       exec($str_zip);
  508.                   }
  509.                   // ----- ZIP log
  510.                   $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'a');
  511.                   if ($fp)
  512.                   {
  513.                       @fwrite($fp$str_zip "\r\n\r\n");
  514.                       @fclose($fp);
  515.                   }
  516.                   unlink($Arq_input);
  517.                   $this->Arquivo_view $zip_arq_v;
  518.                   if ($this->Tem_xml_res)
  519.                   { 
  520.                       $str_zip   "";
  521.                       $Arq_res   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_file']['view'];
  522.                       $Arq_input = (FALSE !== strpos($Arq_res' ')) ? " \"" $Arq_res "\"" :  $Arq_res;
  523.                       if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  524.                       {
  525.                           $str_zip "zip.exe " strtoupper($Parm_pass) . " -j -u " $this->Xml_password " " $Zip_f " " $Arq_input;
  526.                       }
  527.                       elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  528.                       {
  529.                           $str_zip "./7za " $Parm_pass $this->Xml_password " a " $Zip_f " " $Arq_input;
  530.                       }
  531.                       elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  532.                       {
  533.                           $str_zip "./7za " $Parm_pass $this->Xml_password " a " $Zip_f " " $Arq_input;
  534.                       }
  535.                       if (!empty($str_zip)) {
  536.                           exec($str_zip);
  537.                       }
  538.                       // ----- ZIP log
  539.                       $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'a');
  540.                       if ($fp)
  541.                       {
  542.                           @fwrite($fp$str_zip "\r\n\r\n");
  543.                           @fclose($fp);
  544.                       }
  545.                       unlink($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_file']['view']);
  546.                   }
  547.               } 
  548.               else 
  549.               {
  550.                   $this->Arquivo_view $this->Arq_zip;
  551.               } 
  552.               unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_res_grid']);
  553.           } 
  554.       }
  555.       if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']))
  556.       {
  557.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order'];
  558.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']);
  559.       }
  560.       if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']))
  561.       {
  562.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel'];
  563.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']);
  564.       }
  565.       $rs->Close();
  566.    }
  567.    //----- proprietarios_idproprietario
  568.    function NM_export_proprietarios_idproprietario()
  569.    {
  570.          nmgp_Form_Num_Val($this->proprietarios_idproprietario$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  571.          if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->proprietarios_idproprietario))
  572.          {
  573.              $this->proprietarios_idproprietario sc_convert_encoding($this->proprietarios_idproprietario"UTF-8"$_SESSION['scriptcase']['charset']);
  574.          }
  575.           if ($this->Xml_tag_label)
  576.           {
  577.               $SC_Label = (isset($this->New_label['proprietarios_idproprietario'])) ? $this->New_label['proprietarios_idproprietario'] : "Id Proprietario"
  578.           }
  579.           else
  580.           {
  581.               $SC_Label "proprietarios_idproprietario"
  582.           }
  583.           $this->clear_tag($SC_Label); 
  584.          if ($this->New_Format)
  585.          {
  586.              $this->xml_registro .= " <" $SC_Label ">" $this->trata_dados($this->proprietarios_idproprietario) . "</" $SC_Label ">\r\n";
  587.          }
  588.          else
  589.          {
  590.              $this->xml_registro .= " " $SC_Label " =\"" $this->trata_dados($this->proprietarios_idproprietario) . "\"";
  591.          }
  592.    }
  593.    //----- proprietarios_nome
  594.    function NM_export_proprietarios_nome()
  595.    {
  596.          if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->proprietarios_nome))
  597.          {
  598.              $this->proprietarios_nome sc_convert_encoding($this->proprietarios_nome"UTF-8"$_SESSION['scriptcase']['charset']);
  599.          }
  600.           if ($this->Xml_tag_label)
  601.           {
  602.               $SC_Label = (isset($this->New_label['proprietarios_nome'])) ? $this->New_label['proprietarios_nome'] : "Nome"
  603.           }
  604.           else
  605.           {
  606.               $SC_Label "proprietarios_nome"
  607.           }
  608.           $this->clear_tag($SC_Label); 
  609.          if ($this->New_Format)
  610.          {
  611.              $this->xml_registro .= " <" $SC_Label ">" $this->trata_dados($this->proprietarios_nome) . "</" $SC_Label ">\r\n";
  612.          }
  613.          else
  614.          {
  615.              $this->xml_registro .= " " $SC_Label " =\"" $this->trata_dados($this->proprietarios_nome) . "\"";
  616.          }
  617.    }
  618.    //----- proprietarios_sexo
  619.    function NM_export_proprietarios_sexo()
  620.    {
  621.          if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->proprietarios_sexo))
  622.          {
  623.              $this->proprietarios_sexo sc_convert_encoding($this->proprietarios_sexo"UTF-8"$_SESSION['scriptcase']['charset']);
  624.          }
  625.           if ($this->Xml_tag_label)
  626.           {
  627.               $SC_Label = (isset($this->New_label['proprietarios_sexo'])) ? $this->New_label['proprietarios_sexo'] : "Sexo"
  628.           }
  629.           else
  630.           {
  631.               $SC_Label "proprietarios_sexo"
  632.           }
  633.           $this->clear_tag($SC_Label); 
  634.          if ($this->New_Format)
  635.          {
  636.              $this->xml_registro .= " <" $SC_Label ">" $this->trata_dados($this->proprietarios_sexo) . "</" $SC_Label ">\r\n";
  637.          }
  638.          else
  639.          {
  640.              $this->xml_registro .= " " $SC_Label " =\"" $this->trata_dados($this->proprietarios_sexo) . "\"";
  641.          }
  642.    }
  643.    //----- proprietarios_cpf
  644.    function NM_export_proprietarios_cpf()
  645.    {
  646.          nmgp_Form_Num_Val($this->proprietarios_cpf$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  647.          if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->proprietarios_cpf))
  648.          {
  649.              $this->proprietarios_cpf sc_convert_encoding($this->proprietarios_cpf"UTF-8"$_SESSION['scriptcase']['charset']);
  650.          }
  651.           if ($this->Xml_tag_label)
  652.           {
  653.               $SC_Label = (isset($this->New_label['proprietarios_cpf'])) ? $this->New_label['proprietarios_cpf'] : "Cpf"
  654.           }
  655.           else
  656.           {
  657.               $SC_Label "proprietarios_cpf"
  658.           }
  659.           $this->clear_tag($SC_Label); 
  660.          if ($this->New_Format)
  661.          {
  662.              $this->xml_registro .= " <" $SC_Label ">" $this->trata_dados($this->proprietarios_cpf) . "</" $SC_Label ">\r\n";
  663.          }
  664.          else
  665.          {
  666.              $this->xml_registro .= " " $SC_Label " =\"" $this->trata_dados($this->proprietarios_cpf) . "\"";
  667.          }
  668.    }
  669.    //----- proprietarios_telefone
  670.    function NM_export_proprietarios_telefone()
  671.    {
  672.          if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->proprietarios_telefone))
  673.          {
  674.              $this->proprietarios_telefone sc_convert_encoding($this->proprietarios_telefone"UTF-8"$_SESSION['scriptcase']['charset']);
  675.          }
  676.           if ($this->Xml_tag_label)
  677.           {
  678.               $SC_Label = (isset($this->New_label['proprietarios_telefone'])) ? $this->New_label['proprietarios_telefone'] : "Telefone"
  679.           }
  680.           else
  681.           {
  682.               $SC_Label "proprietarios_telefone"
  683.           }
  684.           $this->clear_tag($SC_Label); 
  685.          if ($this->New_Format)
  686.          {
  687.              $this->xml_registro .= " <" $SC_Label ">" $this->trata_dados($this->proprietarios_telefone) . "</" $SC_Label ">\r\n";
  688.          }
  689.          else
  690.          {
  691.              $this->xml_registro .= " " $SC_Label " =\"" $this->trata_dados($this->proprietarios_telefone) . "\"";
  692.          }
  693.    }
  694.    //----- veiculos_idveiculos
  695.    function NM_export_veiculos_idveiculos()
  696.    {
  697.          nmgp_Form_Num_Val($this->veiculos_idveiculos$_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0""S""2""""N:" $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
  698.          if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->veiculos_idveiculos))
  699.          {
  700.              $this->veiculos_idveiculos sc_convert_encoding($this->veiculos_idveiculos"UTF-8"$_SESSION['scriptcase']['charset']);
  701.          }
  702.           if ($this->Xml_tag_label)
  703.           {
  704.               $SC_Label = (isset($this->New_label['veiculos_idveiculos'])) ? $this->New_label['veiculos_idveiculos'] : "Id Veiculos"
  705.           }
  706.           else
  707.           {
  708.               $SC_Label "veiculos_idveiculos"
  709.           }
  710.           $this->clear_tag($SC_Label); 
  711.          if ($this->New_Format)
  712.          {
  713.              $this->xml_registro .= " <" $SC_Label ">" $this->trata_dados($this->veiculos_idveiculos) . "</" $SC_Label ">\r\n";
  714.          }
  715.          else
  716.          {
  717.              $this->xml_registro .= " " $SC_Label " =\"" $this->trata_dados($this->veiculos_idveiculos) . "\"";
  718.          }
  719.    }
  720.    //----- veiculos_anomodelo
  721.    function NM_export_veiculos_anomodelo()
  722.    {
  723.          if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->veiculos_anomodelo))
  724.          {
  725.              $this->veiculos_anomodelo sc_convert_encoding($this->veiculos_anomodelo"UTF-8"$_SESSION['scriptcase']['charset']);
  726.          }
  727.           if ($this->Xml_tag_label)
  728.           {
  729.               $SC_Label = (isset($this->New_label['veiculos_anomodelo'])) ? $this->New_label['veiculos_anomodelo'] : "Ano Modelo"
  730.           }
  731.           else
  732.           {
  733.               $SC_Label "veiculos_anomodelo"
  734.           }
  735.           $this->clear_tag($SC_Label); 
  736.          if ($this->New_Format)
  737.          {
  738.              $this->xml_registro .= " <" $SC_Label ">" $this->trata_dados($this->veiculos_anomodelo) . "</" $SC_Label ">\r\n";
  739.          }
  740.          else
  741.          {
  742.              $this->xml_registro .= " " $SC_Label " =\"" $this->trata_dados($this->veiculos_anomodelo) . "\"";
  743.          }
  744.    }
  745.    //----- veiculos_placa
  746.    function NM_export_veiculos_placa()
  747.    {
  748.          if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->veiculos_placa))
  749.          {
  750.              $this->veiculos_placa sc_convert_encoding($this->veiculos_placa"UTF-8"$_SESSION['scriptcase']['charset']);
  751.          }
  752.           if ($this->Xml_tag_label)
  753.           {
  754.               $SC_Label = (isset($this->New_label['veiculos_placa'])) ? $this->New_label['veiculos_placa'] : "Placa"
  755.           }
  756.           else
  757.           {
  758.               $SC_Label "veiculos_placa"
  759.           }
  760.           $this->clear_tag($SC_Label); 
  761.          if ($this->New_Format)
  762.          {
  763.              $this->xml_registro .= " <" $SC_Label ">" $this->trata_dados($this->veiculos_placa) . "</" $SC_Label ">\r\n";
  764.          }
  765.          else
  766.          {
  767.              $this->xml_registro .= " " $SC_Label " =\"" $this->trata_dados($this->veiculos_placa) . "\"";
  768.          }
  769.    }
  770.    //----- proprietarios_endereco
  771.    function NM_export_proprietarios_endereco()
  772.    {
  773.          if ($_SESSION['scriptcase']['charset'] == "UTF-8" && !NM_is_utf8($this->proprietarios_endereco))
  774.          {
  775.              $this->proprietarios_endereco sc_convert_encoding($this->proprietarios_endereco"UTF-8"$_SESSION['scriptcase']['charset']);
  776.          }
  777.           if ($this->Xml_tag_label)
  778.           {
  779.               $SC_Label = (isset($this->New_label['proprietarios_endereco'])) ? $this->New_label['proprietarios_endereco'] : "Endereco"
  780.           }
  781.           else
  782.           {
  783.               $SC_Label "proprietarios_endereco"
  784.           }
  785.           $this->clear_tag($SC_Label); 
  786.          if ($this->New_Format)
  787.          {
  788.              $this->xml_registro .= " <" $SC_Label ">" $this->trata_dados($this->proprietarios_endereco) . "</" $SC_Label ">\r\n";
  789.          }
  790.          else
  791.          {
  792.              $this->xml_registro .= " " $SC_Label " =\"" $this->trata_dados($this->proprietarios_endereco) . "\"";
  793.          }
  794.    }

  795.    //----- 
  796.    function trata_dados($conteudo)
  797.    {
  798.       $str_temp =  $conteudo;
  799.       $str_temp =  str_replace("<br />""",  $str_temp);
  800.       $str_temp =  str_replace("&""&amp;",  $str_temp);
  801.       $str_temp =  str_replace("<""&lt;",   $str_temp);
  802.       $str_temp =  str_replace(">""&gt;",   $str_temp);
  803.       $str_temp =  str_replace("'""&apos;"$str_temp);
  804.       $str_temp =  str_replace('"'"&quot;",  $str_temp);
  805.       $str_temp =  str_replace('('"_",  $str_temp);
  806.       $str_temp =  str_replace(')'"",  $str_temp);
  807.       return ($str_temp);
  808.    }

  809.    function clear_tag(&$conteudo)
  810.    {
  811.       $out = (is_numeric(substr($conteudo01)) || substr($conteudo01) == "") ? "_" "";
  812.       $str_temp "abcdefghijklmnopqrstuwxyz0123456789";
  813.       for ($i 0$i strlen($conteudo); $i++)
  814.       {
  815.           $char substr($conteudo$i1);
  816.           $ok false;
  817.           for ($z 0$z strlen($str_temp); $z++)
  818.           {
  819.               if (strtolower($char) == substr($str_temp$z1))
  820.               {
  821.                   $ok true;
  822.                   break;
  823.               }
  824.           }
  825.           $out .= ($ok) ? $char "_";
  826.       }
  827.       $conteudo $out;
  828.    }

  829.    function nm_conv_data_db($dt_in$form_in$form_out)
  830.    {
  831.        $dt_out $dt_in;
  832.        if (strtoupper($form_in) == "DB_FORMAT")
  833.        {
  834.            if ($dt_out == "null" || $dt_out == "")
  835.            {
  836.                $dt_out "";
  837.                return $dt_out;
  838.            }
  839.            $form_in "AAAA-MM-DD";
  840.        }
  841.        if (strtoupper($form_out) == "DB_FORMAT")
  842.        {
  843.            if (empty($dt_out))
  844.            {
  845.                $dt_out "null";
  846.                return $dt_out;
  847.            }
  848.            $form_out "AAAA-MM-DD";
  849.        }
  850.        nm_conv_form_data($dt_out$form_in$form_out);
  851.        return $dt_out;
  852.    }
  853.    function progress_bar_end()
  854.    {
  855.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file']);
  856.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  857.       {
  858.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  859.       }
  860.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  861.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  862.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  863.       $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  864.       if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  865.           $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  866.       }
  867.       $this->pb->setProgressbarMessage($Mens_bar);
  868.       $this->pb->setDownloadLink($this->Ini->path_imag_temp "/" $this->Arquivo);
  869.       $this->pb->setDownloadMd5($path_doc_md5);
  870.       $this->pb->completed();
  871.    }
  872.    //---- 
  873.    function monta_html()
  874.    {
  875.       global $nm_url_saida$nm_lang;
  876.       include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  877.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file']);
  878.       if (is_file($this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo))
  879.       {
  880.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_file'] = $this->Ini->root $this->Ini->path_imag_temp "/" $this->Arquivo;
  881.       }
  882.       $path_doc_md5 md5($this->Ini->path_imag_temp "/" $this->Arquivo);
  883.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp "/" $this->Arquivo;
  884.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = $this->Tit_doc;
  885. ?>
  886. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  887.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  888. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  889. <HEAD>
  890.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: XML</TITLE>
  891.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  892. <?php
  893. if ($_SESSION['scriptcase']['proc_mobile'])
  894. {
  895. ?>
  896.   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  897. <?php
  898. }
  899. ?>
  900.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  901.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  902.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  903.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  904.  <META http-equiv="Pragma" content="no-cache"/>
  905.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  906.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  907.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  908.  <?php
  909.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  910.  {
  911.  ?>
  912.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  913.  <?php
  914.  }
  915.  ?>
  916.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  917. </HEAD>
  918. <BODY class="scExportPage">
  919. <?php echo $this->Ini->Ajax_result_set ?>
  920. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  921.  <table class="scExportTable" align="center">
  922.   <tr>
  923.    <td class="scExportTitle" style="height: 25px">XML</td>
  924.   </tr>
  925.   <tr>
  926.    <td class="scExportLine" style="width: 100%">
  927.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  928.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  929.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  930.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  931.  ?>
  932.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  933.  ?>
  934.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  935.  ?>
  936.     </td></tr></table>
  937.    </td>
  938.   </tr>
  939.  </table>
  940. </td></tr></table>
  941. <form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp "/" $this->Arquivo_view ?>" target="_blank" style="display: none"> 
  942. </form>
  943. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  944. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  945. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  946. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  947. </form>
  948. <FORM name="F0" method=post action="./" style="display: none"> 
  949. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  950. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  951. <INPUT type="hidden" name="nmgp_opcao" value="<?php echo NM_encode_input($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_return']); ?>"> 
  952. </FORM> 
  953. </BODY>
  954. </HTML>
  955. <?php
  956.    }
  957.    function nm_gera_mask(&$nm_campo$nm_mask)
  958.    { 
  959.       $trab_campo $nm_campo;
  960.       $trab_mask  $nm_mask;
  961.       $tam_campo  strlen($nm_campo);
  962.       $trab_saida "";
  963.       $mask_num false;
  964.       for ($x=0$x strlen($trab_mask); $x++)
  965.       {
  966.           if (substr($trab_mask$x1) == "#")
  967.           {
  968.               $mask_num true;
  969.               break;
  970.           }
  971.       }
  972.       if ($mask_num )
  973.       {
  974.           $ver_duas explode(";"$trab_mask);
  975.           if (isset($ver_duas[1]) && !empty($ver_duas[1]))
  976.           {
  977.               $cont1 count(explode("#"$ver_duas[0])) - 1;
  978.               $cont2 count(explode("#"$ver_duas[1])) - 1;
  979.               if ($cont2 >= $tam_campo)
  980.               {
  981.                   $trab_mask $ver_duas[1];
  982.               }
  983.               else
  984.               {
  985.                   $trab_mask $ver_duas[0];
  986.               }
  987.           }
  988.           $tam_mask strlen($trab_mask);
  989.           $xdados 0;
  990.           for ($x=0$x $tam_mask$x++)
  991.           {
  992.               if (substr($trab_mask$x1) == "#" && $xdados $tam_campo)
  993.               {
  994.                   $trab_saida .= substr($trab_campo$xdados1);
  995.                   $xdados++;
  996.               }
  997.               elseif ($xdados $tam_campo)
  998.               {
  999.                   $trab_saida .= substr($trab_mask$x1);
  1000.               }
  1001.           }
  1002.           if ($xdados $tam_campo)
  1003.           {
  1004.               $trab_saida .= substr($trab_campo$xdados);
  1005.           }
  1006.           $nm_campo $trab_saida;
  1007.           return;
  1008.       }
  1009.       for ($ix strlen($trab_mask); $ix 0$ix--)
  1010.       {
  1011.            $char_mask substr($trab_mask$ix 11);
  1012.            if ($char_mask != "x" && $char_mask != "z")
  1013.            {
  1014.                $trab_saida $char_mask $trab_saida;
  1015.            }
  1016.            else
  1017.            {
  1018.                if ($tam_campo != 0)
  1019.                {
  1020.                    $trab_saida substr($trab_campo$tam_campo 11) . $trab_saida;
  1021.                    $tam_campo--;
  1022.                }
  1023.                else
  1024.                {
  1025.                    $trab_saida "0" $trab_saida;
  1026.                }
  1027.            }
  1028.       }
  1029.       if ($tam_campo != 0)
  1030.       {
  1031.           $trab_saida substr($trab_campo0$tam_campo) . $trab_saida;
  1032.           $trab_mask  str_repeat("z"$tam_campo) . $trab_mask;
  1033.       }
  1034.    
  1035.       $iz 0
  1036.       for ($ix 0$ix strlen($trab_mask); $ix++)
  1037.       {
  1038.            $char_mask substr($trab_mask$ix1);
  1039.            if ($char_mask != "x" && $char_mask != "z")
  1040.            {
  1041.                if ($char_mask == "." || $char_mask == ",")
  1042.                {
  1043.                    $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  1044.                }
  1045.                else
  1046.                {
  1047.                    $iz++;
  1048.                }
  1049.            }
  1050.            elseif ($char_mask == "x" || substr($trab_saida$iz1) != "0")
  1051.            {
  1052.                $ix strlen($trab_mask) + 1;
  1053.            }
  1054.            else
  1055.            {
  1056.                $trab_saida substr($trab_saida0$iz) . substr($trab_saida$iz 1);
  1057.            }
  1058.       }
  1059.       $nm_campo $trab_saida;
  1060.    } 
  1061. }

  1062. ?>
Return
index.php
  1. <?php
  2.    include_once('grid_new_session.php');
  3.    @session_start() ;
  4.    $_SESSION['scriptcase']['grid_new']['glo_nm_perfil']          = "";
  5.    $_SESSION['scriptcase']['grid_new']['glo_nm_path_prod']       = "/scriptcase/prod";
  6.    $_SESSION['scriptcase']['grid_new']['glo_nm_path_conf']       = "/Applications/Scriptcase/v9-php73/wwwroot/scriptcase/conf";
  7.    $_SESSION['scriptcase']['grid_new']['glo_nm_path_imagens']    = "/scriptcase/file/img";
  8.    $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']  = "/scriptcase/tmp";
  9.    $_SESSION['scriptcase']['grid_new']['glo_nm_path_doc']        = "/Applications/Scriptcase/v9-php73/wwwroot/scriptcase/file/doc";
  10.    $_SESSION['scriptcase']['grid_new']['glo_nm_conexao']         = "conn_mysql";
  11.     //check publication with the prod
  12.     $NM_dir_atual getcwd();
  13.     if (empty($NM_dir_atual))
  14.     {
  15.         $str_path_sys          = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  16.         $str_path_sys          str_replace("\\"'/'$str_path_sys);
  17.     }
  18.     else
  19.     {
  20.         $sc_nm_arquivo         explode("/"$_SERVER['PHP_SELF']);
  21.         $str_path_sys          str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  22.     }
  23.     $str_path_apl_url $_SERVER['PHP_SELF'];
  24.     $str_path_apl_url str_replace("\\"'/'$str_path_apl_url);
  25.     $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/"));
  26.     $str_path_apl_url substr($str_path_apl_url0strrpos($str_path_apl_url"/")+1);
  27.     $str_path_apl_dir substr($str_path_sys0strrpos($str_path_sys"/"));
  28.     $str_path_apl_dir substr($str_path_apl_dir0strrpos($str_path_apl_dir"/")+1);
  29.     //check prod
  30.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_prod']))
  31.     {
  32.             /*check prod*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_prod'] = $str_path_apl_url "_lib/prod";
  33.     }
  34.     //check img
  35.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imagens']))
  36.     {
  37.             /*check img*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imagens'] = $str_path_apl_url "_lib/file/img";
  38.     }
  39.     //check tmp
  40.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp']))
  41.     {
  42.             /*check tmp*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] = $str_path_apl_url "_lib/tmp";
  43.     }
  44.     //check doc
  45.     if(empty($_SESSION['scriptcase']['grid_new']['glo_nm_path_doc']))
  46.     {
  47.             /*check doc*/$_SESSION['scriptcase']['grid_new']['glo_nm_path_doc'] = $str_path_apl_dir "_lib/file/doc";
  48.     }
  49.     //end check publication with the prod
  50. //
  51. class grid_new_ini
  52. {
  53.    var $nm_cod_apl;
  54.    var $nm_nome_apl;
  55.    var $nm_seguranca;
  56.    var $nm_grupo;
  57.    var $nm_autor;
  58.    var $nm_versao_sc;
  59.    var $nm_tp_lic_sc;
  60.    var $nm_dt_criacao;
  61.    var $nm_hr_criacao;
  62.    var $nm_autor_alt;
  63.    var $nm_dt_ult_alt;
  64.    var $nm_hr_ult_alt;
  65.    var $nm_timestamp;
  66.    var $nm_app_version;
  67.    var $cor_link_dados;
  68.    var $root;
  69.    var $server;
  70.    var $java_protocol;
  71.    var $server_pdf;
  72.    var $Arr_result;
  73.    var $sc_protocolo;
  74.    var $path_prod;
  75.    var $path_link;
  76.    var $path_aplicacao;
  77.    var $path_embutida;
  78.    var $path_botoes;
  79.    var $path_img_global;
  80.    var $path_img_modelo;
  81.    var $path_icones;
  82.    var $path_imagens;
  83.    var $path_imag_cab;
  84.    var $path_imag_temp;
  85.    var $path_libs;
  86.    var $path_doc;
  87.    var $str_lang;
  88.    var $str_conf_reg;
  89.    var $str_schema_all;
  90.    var $Str_btn_grid;
  91.    var $str_google_fonts;
  92.    var $str_schema_filter;
  93.    var $Str_btn_filter;
  94.    var $path_cep;
  95.    var $path_secure;
  96.    var $path_js;
  97.    var $path_help;
  98.    var $path_adodb;
  99.    var $path_grafico;
  100.    var $path_atual;
  101.    var $Gd_missing;
  102.    var $sc_site_ssl;
  103.    var $nm_cont_lin;
  104.    var $nm_limite_lin;
  105.    var $nm_limite_lin_prt;
  106.    var $nm_limite_lin_res;
  107.    var $nm_limite_lin_res_prt;
  108.    var $nm_falta_var;
  109.    var $nm_falta_var_db;
  110.    var $nm_tpbanco;
  111.    var $nm_servidor;
  112.    var $nm_usuario;
  113.    var $nm_senha;
  114.    var $nm_database_encoding;
  115.    var $nm_arr_db_extra_args = array();
  116.    var $nm_con_db2 = array();
  117.    var $nm_con_persistente;
  118.    var $nm_con_use_schema;
  119.    var $nm_tabela;
  120.    var $nm_ger_css_emb;
  121.    var $nm_col_dinamica   = array();
  122.    var $nm_order_dinamico = array();
  123.    var $nm_hidden_blocos  = array();
  124.    var $sc_tem_trans_banco;
  125.    var $nm_bases_all;
  126.    var $nm_bases_access;
  127.    var $nm_bases_db2;
  128.    var $nm_bases_ibase;
  129.    var $nm_bases_informix;
  130.    var $nm_bases_mssql;
  131.    var $nm_bases_mysql;
  132.    var $nm_bases_postgres;
  133.    var $nm_bases_oracle;
  134.    var $nm_bases_sqlite;
  135.    var $nm_bases_sybase;
  136.    var $nm_bases_vfp;
  137.    var $nm_bases_odbc;
  138.    var $nm_bases_progress;
  139.    var $sc_page;
  140.    var $sc_lig_md5 = array();
  141.    var $sc_lig_target = array();
  142.    var $sc_export_ajax false;
  143.    var $sc_export_ajax_img false;
  144. //
  145.    function init($Tp_init "")
  146.    {
  147.        global
  148.              $nm_url_saida$nm_apl_dependente$script_case_init$nmgp_opcao;

  149.       if (!function_exists("sc_check_mobile"))
  150.       {
  151.           include_once("../_lib/lib/php/nm_check_mobile.php");
  152.       }
  153.       $_SESSION['scriptcase']['proc_mobile'] = sc_check_mobile();
  154.       @ini_set('magic_quotes_runtime'0);
  155.       $this->sc_page $script_case_init;
  156.       $_SESSION['scriptcase']['sc_num_page'] = $script_case_init;
  157.       $_SESSION['scriptcase']['sc_cnt_sql']  = 0;
  158.       $this->sc_charset['UTF-8'] = 'utf-8';
  159.       $this->sc_charset['ISO-2022-JP'] = 'iso-2022-jp';
  160.       $this->sc_charset['ISO-2022-KR'] = 'iso-2022-kr';
  161.       $this->sc_charset['ISO-8859-1'] = 'iso-8859-1';
  162.       $this->sc_charset['ISO-8859-2'] = 'iso-8859-2';
  163.       $this->sc_charset['ISO-8859-3'] = 'iso-8859-3';
  164.       $this->sc_charset['ISO-8859-4'] = 'iso-8859-4';
  165.       $this->sc_charset['ISO-8859-5'] = 'iso-8859-5';
  166.       $this->sc_charset['ISO-8859-6'] = 'iso-8859-6';
  167.       $this->sc_charset['ISO-8859-7'] = 'iso-8859-7';
  168.       $this->sc_charset['ISO-8859-8'] = 'iso-8859-8';
  169.       $this->sc_charset['ISO-8859-8-I'] = 'iso-8859-8-i';
  170.       $this->sc_charset['ISO-8859-9'] = 'iso-8859-9';
  171.       $this->sc_charset['ISO-8859-10'] = 'iso-8859-10';
  172.       $this->sc_charset['ISO-8859-13'] = 'iso-8859-13';
  173.       $this->sc_charset['ISO-8859-14'] = 'iso-8859-14';
  174.       $this->sc_charset['ISO-8859-15'] = 'iso-8859-15';
  175.       $this->sc_charset['WINDOWS-1250'] = 'windows-1250';
  176.       $this->sc_charset['WINDOWS-1251'] = 'windows-1251';
  177.       $this->sc_charset['WINDOWS-1252'] = 'windows-1252';
  178.       $this->sc_charset['TIS-620'] = 'tis-620';
  179.       $this->sc_charset['WINDOWS-1253'] = 'windows-1253';
  180.       $this->sc_charset['WINDOWS-1254'] = 'windows-1254';
  181.       $this->sc_charset['WINDOWS-1255'] = 'windows-1255';
  182.       $this->sc_charset['WINDOWS-1256'] = 'windows-1256';
  183.       $this->sc_charset['WINDOWS-1257'] = 'windows-1257';
  184.       $this->sc_charset['KOI8-R'] = 'koi8-r';
  185.       $this->sc_charset['BIG-5'] = 'big5';
  186.       $this->sc_charset['EUC-CN'] = 'EUC-CN';
  187.       $this->sc_charset['GB18030'] = 'GB18030';
  188.       $this->sc_charset['GB2312'] = 'gb2312';
  189.       $this->sc_charset['EUC-JP'] = 'euc-jp';
  190.       $this->sc_charset['SJIS'] = 'shift-jis';
  191.       $this->sc_charset['EUC-KR'] = 'euc-kr';
  192.       $_SESSION['scriptcase']['charset_entities']['UTF-8'] = 'UTF-8';
  193.       $_SESSION['scriptcase']['charset_entities']['ISO-8859-1'] = 'ISO-8859-1';
  194.       $_SESSION['scriptcase']['charset_entities']['ISO-8859-5'] = 'ISO-8859-5';
  195.       $_SESSION['scriptcase']['charset_entities']['ISO-8859-15'] = 'ISO-8859-15';
  196.       $_SESSION['scriptcase']['charset_entities']['WINDOWS-1251'] = 'cp1251';
  197.       $_SESSION['scriptcase']['charset_entities']['WINDOWS-1252'] = 'cp1252';
  198.       $_SESSION['scriptcase']['charset_entities']['BIG-5'] = 'BIG5';
  199.       $_SESSION['scriptcase']['charset_entities']['EUC-CN'] = 'GB2312';
  200.       $_SESSION['scriptcase']['charset_entities']['GB2312'] = 'GB2312';
  201.       $_SESSION['scriptcase']['charset_entities']['SJIS'] = 'Shift_JIS';
  202.       $_SESSION['scriptcase']['charset_entities']['EUC-JP'] = 'EUC-JP';
  203.       $_SESSION['scriptcase']['charset_entities']['KOI8-R'] = 'KOI8-R';
  204.       $_SESSION['scriptcase']['trial_version'] = 'N';
  205.       $_SESSION['sc_session'][$this->sc_page]['grid_new']['decimal_db'] = "."
  206.       $this->nm_cod_apl      "grid_new"
  207.       $this->nm_nome_apl     ""
  208.       $this->nm_seguranca    ""
  209.       $this->nm_grupo        "Projeto7"
  210.       $this->nm_grupo_versao "1"
  211.       $this->nm_autor        "admin"
  212.       $this->nm_script_by    "netmake";
  213.       $this->nm_script_type  "PHP";
  214.       $this->nm_versao_sc    "v9"
  215.       $this->nm_tp_lic_sc    "demo"
  216.       $this->nm_dt_criacao   "20200129"
  217.       $this->nm_hr_criacao   "205716"
  218.       $this->nm_autor_alt    "admin"
  219.       $this->nm_dt_ult_alt   "20200129"
  220.       $this->nm_hr_ult_alt   "210141"
  221.       $this->Apl_paginacao   "PARCIAL"
  222.       $temp_bug_list         explode(" "microtime()); 
  223.       list($NM_usec$NM_sec) = $temp_bug_list
  224.       $this->nm_timestamp    = (float) $NM_sec
  225.       $this->nm_app_version  "1.0.0";
  226. // 
  227. // 
  228.       $NM_dir_atual getcwd();
  229.       if (empty($NM_dir_atual))
  230.       {
  231.           $str_path_sys          = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  232.           $str_path_sys          str_replace("\\"'/'$str_path_sys);
  233.       }
  234.       else
  235.       {
  236.           $sc_nm_arquivo         explode("/"$_SERVER['PHP_SELF']);
  237.           $str_path_sys          str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  238.       }
  239.       $this->sc_site_ssl     $this->appIsSsl();
  240.       $this->sc_protocolo    $this->sc_site_ssl 'https://' 'http://';
  241.       $this->sc_protocolo    "";
  242.       $this->path_prod       $_SESSION['scriptcase']['grid_new']['glo_nm_path_prod'];
  243.       $this->path_conf       $_SESSION['scriptcase']['grid_new']['glo_nm_path_conf'];
  244.       $this->path_imagens    $_SESSION['scriptcase']['grid_new']['glo_nm_path_imagens'];
  245.       $this->path_imag_temp  $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'];
  246.       $this->path_doc        $_SESSION['scriptcase']['grid_new']['glo_nm_path_doc'];
  247.       if (!isset($_SESSION['scriptcase']['str_lang']) || empty($_SESSION['scriptcase']['str_lang']))
  248.       {
  249.           $_SESSION['scriptcase']['str_lang'] = "en_us";
  250.       }
  251.       if (!isset($_SESSION['scriptcase']['str_conf_reg']) || empty($_SESSION['scriptcase']['str_conf_reg']))
  252.       {
  253.           $_SESSION['scriptcase']['str_conf_reg'] = "pt_br";
  254.       }
  255.       $this->str_lang        $_SESSION['scriptcase']['str_lang'];
  256.       $this->str_conf_reg    $_SESSION['scriptcase']['str_conf_reg'];
  257.       $this->str_schema_all    = (isset($_SESSION['scriptcase']['str_schema_all']) && !empty($_SESSION['scriptcase']['str_schema_all'])) ? $_SESSION['scriptcase']['str_schema_all'] : "Sc9_Midnight/Sc9_Midnight";
  258.       $this->str_schema_filter = (isset($_SESSION['scriptcase']['str_schema_all']) && !empty($_SESSION['scriptcase']['str_schema_all'])) ? $_SESSION['scriptcase']['str_schema_all'] : "Sc9_Midnight/Sc9_Midnight";
  259.       $_SESSION['scriptcase']['erro']['str_schema'] = $this->str_schema_all "_error.css";
  260.       $_SESSION['scriptcase']['erro']['str_lang']   = $this->str_lang;
  261.       $this->server          = (!isset($_SERVER['HTTP_HOST'])) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
  262.       if (!isset($_SERVER['HTTP_HOST']) && isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80 && !$this->sc_site_ssl )
  263.       {
  264.           $this->server         .= ":" $_SERVER['SERVER_PORT'];
  265.       }
  266.       $this->java_protocol   = ($this->sc_site_ssl) ? 'https://' 'http://';
  267.       $this->server_pdf      $this->java_protocol $this->server;
  268.       $this->server          "";
  269.       $str_path_web          $_SERVER['PHP_SELF'];
  270.       $str_path_web          str_replace("\\"'/'$str_path_web);
  271.       $str_path_web          str_replace('//''/'$str_path_web);
  272.       $this->root            substr($str_path_sys0, -strlen($str_path_web));
  273.       $this->path_aplicacao  substr($str_path_sys0strrpos($str_path_sys'/'));
  274.       $this->path_aplicacao  substr($this->path_aplicacao0strrpos($this->path_aplicacao'/')) . '/grid_new';
  275.       $this->path_embutida   substr($this->path_aplicacao0strrpos($this->path_aplicacao'/') + 1);
  276.       $this->path_aplicacao .= '/';
  277.       $this->path_link       substr($str_path_web0strrpos($str_path_web'/'));
  278.       $this->path_link       substr($this->path_link0strrpos($this->path_link'/')) . '/';
  279.       $this->path_botoes     $this->path_link "_lib/img";
  280.       $this->path_img_global $this->path_link "_lib/img";
  281.       $this->path_img_modelo $this->path_link "_lib/img";
  282.       $this->path_icones     $this->path_link "_lib/img";
  283.       $this->path_imag_cab   $this->path_link "_lib/img";
  284.       $this->path_help       $this->path_link "_lib/webhelp/";
  285.       $this->path_font       $this->root $this->path_link "_lib/font/";
  286.       $this->path_btn        $this->root $this->path_link "_lib/buttons/";
  287.       $this->path_css        $this->root $this->path_link "_lib/css/";
  288.       $this->path_lib_php    $this->root $this->path_link "_lib/lib/php";
  289.       $this->path_lib_js     $this->root $this->path_link "_lib/lib/js";
  290.       $pos_path strrpos($this->path_prod"/");
  291.       $_SESSION['sc_session'][$this->sc_page]['grid_new']['path_grid_sv'] = $this->root substr($this->path_prod0$pos_path) . "/conf/grid_sv/";
  292.       $this->path_lang       "../_lib/lang/";
  293.       $this->path_lang_js    "../_lib/js/";
  294.       $this->path_chart_theme $this->root $this->path_link "_lib/chart/";
  295.       $this->path_cep        $this->path_prod "/cep";
  296.       $this->path_cor        $this->path_prod "/cor";
  297.       $this->path_js         $this->path_prod "/lib/js";
  298.       $this->path_libs       $this->root $this->path_prod "/lib/php";
  299.       $this->path_third      $this->root $this->path_prod "/third";
  300.       $this->path_secure     $this->root $this->path_prod "/secure";
  301.       $this->path_adodb      $this->root $this->path_prod "/third/adodb";
  302.       $_SESSION['scriptcase']['dir_temp'] = $this->root $this->path_imag_temp;
  303.       $this->Cmp_Sql_Time     = array();
  304.       if (isset($_SESSION['scriptcase']['grid_new']['session_timeout']['lang'])) {
  305.           $this->str_lang $_SESSION['scriptcase']['grid_new']['session_timeout']['lang'];
  306.       }
  307.       elseif (!isset($_SESSION['scriptcase']['grid_new']['actual_lang']) || $_SESSION['scriptcase']['grid_new']['actual_lang'] != $this->str_lang) {
  308.           $_SESSION['scriptcase']['grid_new']['actual_lang'] = $this->str_lang;
  309.           setcookie('sc_actual_lang_Projeto7',$this->str_lang,'0','/');
  310.       }
  311.       if (!isset($_SESSION['scriptcase']['fusioncharts_new']))
  312.       {
  313.           $_SESSION['scriptcase']['fusioncharts_new'] = @is_dir($this->path_third '/oem_fs');
  314.       }
  315.       if (!isset($_SESSION['scriptcase']['phantomjs_charts']))
  316.       {
  317.           $_SESSION['scriptcase']['phantomjs_charts'] = @is_dir($this->path_third '/phantomjs');
  318.       }
  319.       if (isset($_SESSION['scriptcase']['phantomjs_charts']))
  320.       {
  321.           $aTmpOS $this->getRunningOS();
  322.           $_SESSION['scriptcase']['phantomjs_charts'] = @is_dir($this->path_third '/phantomjs/' $aTmpOS['os']);
  323.       }
  324.       if (!class_exists('Services_JSON'))
  325.       {
  326.           include_once("grid_new_json.php");
  327.       }
  328.       $this->SC_Link_View = (isset($_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_Link_View'])) ? $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_Link_View'] : false;
  329.       if (isset($_GET['SC_Link_View']) && !empty($_GET['SC_Link_View']) && is_numeric($_GET['SC_Link_View']))
  330.       {
  331.           if ($_SESSION['sc_session'][$this->sc_page]['grid_new']['embutida'])
  332.           {
  333.               $this->SC_Link_View true;
  334.               $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_Link_View'] = true;
  335.           }
  336.       }
  337.     if (!$_SESSION['sc_session'][$this->sc_page]['grid_new']['embutida'])
  338.     {
  339.       if (isset($_POST['nmgp_opcao']) && $_POST['nmgp_opcao'] == "ajax_add_grid_search")
  340.       {
  341.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['grid_search_add']['cmp'] = $_POST['parm'];
  342.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['grid_search_add']['seq'] = $_POST['seq'];
  343.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['opcao'] = $_POST['origem'];
  344.           $nmgp_opcao $_POST['origem'];
  345.       }
  346.       if (isset($_GET['nmgp_opcao']) && $_GET['nmgp_opcao'] == "ajax_aut_comp_dyn_search")
  347.       {
  348.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['dyn_search_aut_comp']['cmp'] = $_GET['field'];
  349.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['opcao'] = $_GET['origem'];
  350.           $nmgp_opcao $_GET['origem'];
  351.       }
  352.     }
  353.       if (isset($_POST['nmgp_opcao']) && $_POST['nmgp_opcao'] == "ajax_save_ancor")
  354.       {
  355.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['ancor_save'] = $_POST['ancor_save'];
  356.           $oJson = new Services_JSON();
  357.           if ($_SESSION['scriptcase']['sem_session']) {
  358.               unset($_SESSION['sc_session']);
  359.           }
  360.           exit;
  361.       }
  362.       if (isset($_SESSION['scriptcase']['user_logout']))
  363.       {
  364.           foreach ($_SESSION['scriptcase']['user_logout'] as $ind => $parms)
  365.           {
  366.               if (isset($_SESSION[$parms['V']]) && $_SESSION[$parms['V']] == $parms['U'])
  367.               {
  368.                   unset($_SESSION['scriptcase']['user_logout'][$ind]);
  369.                   $nm_apl_dest $parms['R'];
  370.                   $dir explode("/"$nm_apl_dest);
  371.                   if (count($dir) == 1)
  372.                   {
  373.                       $nm_apl_dest str_replace(".php"""$nm_apl_dest);
  374.                       $nm_apl_dest $this->path_link SC_dir_app_name($nm_apl_dest) . "/";
  375.                   }
  376.                   if (isset($_POST['nmgp_opcao']) && ($_POST['nmgp_opcao'] == "ajax_event" || $_POST['nmgp_opcao'] == "ajax_navigate"))
  377.                   {
  378.                       $this->Arr_result = array();
  379.                       $this->Arr_result['redirInfo']['action']              = $nm_apl_dest;
  380.                       $this->Arr_result['redirInfo']['target']              = $parms['T'];
  381.                       $this->Arr_result['redirInfo']['metodo']              = "post";
  382.                       $this->Arr_result['redirInfo']['script_case_init']    = $this->sc_page;
  383.                       $this->Arr_result['redirInfo']['script_case_session'] = session_id();
  384.                       $oJson = new Services_JSON();
  385.                       echo $oJson->encode($this->Arr_result);
  386.                       exit;
  387.                   }
  388. ?>
  389.                   <html>
  390.                   <body>
  391.                   <form name="FRedirect" method="POST" action="<?php echo $nm_apl_dest?>" target="<?php echo $parms['T']; ?>">
  392.                   </form>
  393.                   <script>
  394.                    document.FRedirect.submit();
  395.                   </script>
  396.                   </body>
  397.                   </html>
  398. <?php
  399.                   exit;
  400.               }
  401.           }
  402.       }
  403.       global $under_dashboard$dashboard_app$own_widget$parent_widget$compact_mode$remove_margin;
  404.       if (!isset($_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['under_dashboard']))
  405.       {
  406.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['under_dashboard'] = false;
  407.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['dashboard_app']   = '';
  408.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['own_widget']      = '';
  409.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['parent_widget']   = '';
  410.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['compact_mode']    = false;
  411.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['remove_margin']   = false;
  412.       }
  413.       if (isset($_GET['under_dashboard']) && == $_GET['under_dashboard'])
  414.       {
  415.           if (isset($_GET['own_widget']) && 'dbifrm_widget' == substr($_GET['own_widget'], 013)) {
  416.               $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['own_widget'] = $_GET['own_widget'];
  417.               $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['under_dashboard'] = true;
  418.               if (isset($_GET['dashboard_app'])) {
  419.                   $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['dashboard_app'] = $_GET['dashboard_app'];
  420.               }
  421.               if (isset($_GET['parent_widget'])) {
  422.                   $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['parent_widget'] = $_GET['parent_widget'];
  423.               }
  424.               if (isset($_GET['compact_mode'])) {
  425.                   $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['compact_mode'] = == $_GET['compact_mode'];
  426.               }
  427.               if (isset($_GET['remove_margin'])) {
  428.                   $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['remove_margin'] = == $_GET['remove_margin'];
  429.               }
  430.           }
  431.       }
  432.       elseif (isset($under_dashboard) && == $under_dashboard)
  433.       {
  434.           if (isset($own_widget) && 'dbifrm_widget' == substr($own_widget013)) {
  435.               $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['own_widget'] = $own_widget;
  436.               $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['under_dashboard'] = true;
  437.               if (isset($dashboard_app)) {
  438.                   $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['dashboard_app'] = $dashboard_app;
  439.               }
  440.               if (isset($parent_widget)) {
  441.                   $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['parent_widget'] = $parent_widget;
  442.               }
  443.               if (isset($compact_mode)) {
  444.                   $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['compact_mode'] = == $compact_mode;
  445.               }
  446.               if (isset($remove_margin)) {
  447.                   $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['remove_margin'] = == $remove_margin;
  448.               }
  449.           }
  450.       }
  451.       if (!isset($_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['maximized']))
  452.       {
  453.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['maximized'] = false;
  454.       }
  455.       if (isset($_GET['maximized']))
  456.       {
  457.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['maximized'] = == $_GET['maximized'];
  458.       }
  459.       if ($_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['under_dashboard'])
  460.       {
  461.           $sTmpDashboardApp $_SESSION['sc_session'][$this->sc_page]['grid_new']['dashboard_info']['dashboard_app'];
  462.           if ('' != $sTmpDashboardApp && isset($_SESSION['scriptcase']['dashboard_targets'][$sTmpDashboardApp]["grid_new"]))
  463.           {
  464.               foreach ($_SESSION['scriptcase']['dashboard_targets'][$sTmpDashboardApp]["grid_new"] as $sTmpTargetLink => $sTmpTargetWidget)
  465.               {
  466.                   if (isset($this->sc_lig_target[$sTmpTargetLink]))
  467.                   {
  468.                       $this->sc_lig_target[$sTmpTargetLink] = $sTmpTargetWidget;
  469.                   }
  470.               }
  471.           }
  472.       }
  473.       if ($Tp_init == "Path_sub")
  474.       {
  475.           return;
  476.       }
  477.       $str_path substr($this->path_prod0strrpos($this->path_prod'/') + 1);
  478.       if (!is_file($this->root $str_path 'devel/class/xmlparser/nmXmlparserIniSys.class.php'))
  479.       {
  480.           unset($_SESSION['scriptcase']['nm_sc_retorno']);
  481.           unset($_SESSION['scriptcase']['grid_new']['glo_nm_conexao']);
  482.       }
  483.       include($this->path_lang $this->str_lang ".lang.php");
  484.       include($this->path_lang "config_region.php");
  485.       include($this->path_lang "lang_config_region.php");
  486.       asort($this->Nm_lang_conf_region);
  487.       $_SESSION['scriptcase']['charset']  = (isset($this->Nm_lang['Nm_charset']) && !empty($this->Nm_lang['Nm_charset'])) ? $this->Nm_lang['Nm_charset'] : "UTF-8";
  488.       ini_set('default_charset'$_SESSION['scriptcase']['charset']);
  489.       $_SESSION['scriptcase']['charset_html']  = (isset($this->sc_charset[$_SESSION['scriptcase']['charset']])) ? $this->sc_charset[$_SESSION['scriptcase']['charset']] : $_SESSION['scriptcase']['charset'];
  490.       if (!function_exists("mb_convert_encoding"))
  491.       {
  492.           echo "<div><font size=6>" $this->Nm_lang['lang_othr_prod_xtmb'] . "</font></div>";exit;
  493.       } 
  494.       elseif (!function_exists("sc_convert_encoding"))
  495.       {
  496.           echo "<div><font size=6>" $this->Nm_lang['lang_othr_prod_xtsc'] . "</font></div>";exit;
  497.       } 
  498.       foreach ($this->Nm_lang_conf_region as $ind => $dados)
  499.       {
  500.          if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($dados))
  501.          {
  502.              $this->Nm_lang_conf_region[$ind] = sc_convert_encoding($dados$_SESSION['scriptcase']['charset'], "UTF-8");
  503.          }
  504.       }
  505.       foreach ($this->Nm_conf_reg[$this->str_conf_reg] as $ind => $dados)
  506.       {
  507.          if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($dados))
  508.          {
  509.              $this->Nm_conf_reg[$this->str_conf_reg][$ind] = sc_convert_encoding($dados$_SESSION['scriptcase']['charset'], "UTF-8");
  510.          }
  511.       }
  512.       foreach ($this->Nm_lang as $ind => $dados)
  513.       {
  514.          if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($ind))
  515.          {
  516.              $ind sc_convert_encoding($ind$_SESSION['scriptcase']['charset'], "UTF-8");
  517.              $this->Nm_lang[$ind] = $dados;
  518.          }
  519.          if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($dados))
  520.          {
  521.              $this->Nm_lang[$ind] = sc_convert_encoding($dados$_SESSION['scriptcase']['charset'], "UTF-8");
  522.          }
  523.       }
  524.       $_SESSION['sc_session']['SC_download_violation'] = $this->Nm_lang['lang_errm_fnfd'];
  525.       if (isset($_SESSION['sc_session']['SC_parm_violation']) && !isset($_SESSION['scriptcase']['grid_new']['session_timeout']['redir']))
  526.       {
  527.           unset($_SESSION['sc_session']['SC_parm_violation']);
  528.           echo "<html>";
  529.           echo "<body>";
  530.           echo "<table align=\"center\" width=\"50%\" border=1 height=\"50px\">";
  531.           echo "<tr>";
  532.           echo "   <td align=\"center\">";
  533.           echo "       <b><font size=4>" $this->Nm_lang['lang_errm_ajax_data'] . "</font>";
  534.           echo "   </b></td>";
  535.           echo " </tr>";
  536.           echo "</table>";
  537.           echo "</body>";
  538.           echo "</html>";
  539.           exit;
  540.       }
  541.       if (isset($this->Nm_lang['lang_errm_dbcn_conn']))
  542.       {
  543.           $_SESSION['scriptcase']['db_conn_error'] = $this->Nm_lang['lang_errm_dbcn_conn'];
  544.       }
  545.       $PHP_ver str_replace("."""phpversion()); 
  546.       if (substr($PHP_ver03) < 434)
  547.       {
  548.           echo "<div><font size=6>" $this->Nm_lang['lang_othr_prod_phpv'] . "</font></div>";exit;
  549.       } 
  550.       if (file_exists($this->path_libs "/ver.dat"))
  551.       {
  552.           $SC_ver file($this->path_libs "/ver.dat"); 
  553.           $SC_ver str_replace("."""$SC_ver[0]); 
  554.           if (substr($SC_ver05) < 40015)
  555.           {
  556.               echo "<div><font size=6>" $this->Nm_lang['lang_othr_prod_incp'] . "</font></div>";exit;
  557.           } 
  558.       } 
  559.       $_SESSION['sc_session'][$this->sc_page]['grid_new']['path_doc'] = $this->path_doc
  560.       $_SESSION['scriptcase']['nm_path_prod'] = $this->root $this->path_prod "/"
  561.       if (empty($this->path_imag_cab))
  562.       {
  563.           $this->path_imag_cab $this->path_img_global;
  564.       }
  565.       if (!is_dir($this->root $this->path_prod))
  566.       {
  567.           echo "<style type=\"text/css\">";
  568.           echo ".scButton_cancel { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  569.           echo ".scButton_cancel:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#f84d70; border-style:solid; border-radius:4px; background-color:#f84d70; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  570.           echo ".scButton_cancel:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#f23e63; border-style:solid; border-radius:4px; background-color:#f23e63; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  571.           echo ".scButton_cancel_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:3px 13px; cursor:default; transition:all 0.2s;  }";
  572.           echo ".scButton_cancel_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  573.           echo ".scButton_cancel_list { filter: alpha(opacity=100); opacity:1;  }";
  574.           echo ".scButton_cancel_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  575.           echo ".scButton_check { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#0acf97; border-style:solid; border-radius:4px; background-color:#0acf97; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  576.           echo ".scButton_check:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#1abf90; border-style:solid; border-radius:4px; background-color:#1abf90; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  577.           echo ".scButton_check:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#00ab7a; border-style:solid; border-radius:4px; background-color:#00ab7a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  578.           echo ".scButton_check_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#0acf97; border-style:solid; border-radius:4px; background-color:#0acf97; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=50); opacity:0.5; padding:3px 13px; cursor:default;  }";
  579.           echo ".scButton_check_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#00ab7a; border-style:solid; border-radius:4px; background-color:#00ab7a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  580.           echo ".scButton_check_list { filter: alpha(opacity=100); opacity:1;  }";
  581.           echo ".scButton_check_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  582.           echo ".scButton_danger { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  583.           echo ".scButton_danger:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#f84d70; border-style:solid; border-radius:4px; background-color:#f84d70; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  584.           echo ".scButton_danger:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#f23e63; border-style:solid; border-radius:4px; background-color:#f23e63; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  585.           echo ".scButton_danger_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=42); opacity:0.42; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  586.           echo ".scButton_danger_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  587.           echo ".scButton_danger_list { filter: alpha(opacity=100); opacity:1;  }";
  588.           echo ".scButton_danger_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  589.           echo ".scButton_default { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  590.           echo ".scButton_default:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#727cf4; border-style:solid; border-radius:4px; background-color:#727cf4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  591.           echo ".scButton_default:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  592.           echo ".scButton_default_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  593.           echo ".scButton_default_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  594.           echo ".scButton_default_list { background-color:#ffffff; filter: alpha(opacity=100); opacity:1; padding:6px 52px 6px 15px; cursor:pointer; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858;  }";
  595.           echo ".scButton_default_list:hover { background-color:#EFF2F7; filter: alpha(opacity=100); opacity:1; padding:6px 52px 6px 15px; cursor:pointer; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858;  }";
  596.           echo ".scButton_default_list_disabled { background-color:#ffffff; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858; padding:6px 52px 6px 15px; filter: alpha(opacity=45); opacity:0.45; cursor:default;  }";
  597.           echo ".scButton_default_list_selected { background-color:#ffffff; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858; padding:6px 52px 6px 15px; cursor:pointer; filter: alpha(opacity=100); opacity:1;  }";
  598.           echo ".scButton_default_list:active { background-color:#EFF2F7; filter: alpha(opacity=100); opacity:1; padding:6px 52px 6px 15px; cursor:pointer; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858;  }";
  599.           echo ".scButton_facebook { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#3b5998; border-style:solid; border-radius:4px; background-color:#3b5998; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  600.           echo ".scButton_facebook:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#304d8a; border-style:solid; border-radius:4px; background-color:#304d8a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  601.           echo ".scButton_facebook:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2d4373; border-style:solid; border-radius:4px; background-color:#2d4373; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  602.           echo ".scButton_facebook_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#3b5998; border-style:solid; border-radius:4px; background-color:#3b5998; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  603.           echo ".scButton_facebook_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:#3b5998; border-color:#3b5998; border-style:solid; border-radius:4px; background-color:#3b5998; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  604.           echo ".scButton_facebook_list { filter: alpha(opacity=100); opacity:1;  }";
  605.           echo ".scButton_facebook_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  606.           echo ".scButton_fontawesome { color:#8592a6; font-size:15px; text-decoration:none; border-style:none; filter: alpha(opacity=100); opacity:1; padding:5px; cursor:pointer; transition:all 0.2s;  }";
  607.           echo ".scButton_fontawesome:hover { color:#8592a6; font-size:15px; text-decoration:none; border-style:none; filter: alpha(opacity=100); opacity:1; padding:5px; cursor:pointer; transition:all 0.2s;  }";
  608.           echo ".scButton_fontawesome:active { color:#8592a6; font-size:15px; text-decoration:none; filter: alpha(opacity=100); opacity:1; padding:5px; cursor:pointer; transition:all 0.2s;  }";
  609.           echo ".scButton_fontawesome_disabled { color:#8592a6; font-size:15px; text-decoration:none; border-style:none; filter: alpha(opacity=44); opacity:0.44; padding:5px; cursor:default; transition:all 0.2s;  }";
  610.           echo ".scButton_fontawesome_selected { color:#8592a6; font-size:15px; text-decoration:none; border-style:none; filter: alpha(opacity=100); opacity:1; padding:5px; cursor:pointer; transition:all 0.2s;  }";
  611.           echo ".scButton_fontawesome_list { filter: alpha(opacity=100); opacity:1;  }";
  612.           echo ".scButton_fontawesome_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  613.           echo ".scButton_google { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#dd4b39; border-style:solid; border-radius:4px; background-color:#dd4b39; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  614.           echo ".scButton_google:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#e0321c; border-style:solid; border-radius:4px; background-color:#e0321c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  615.           echo ".scButton_google:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#c23321; border-style:solid; border-radius:4px; background-color:#c23321; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  616.           echo ".scButton_google_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#dd4b39; border-style:solid; border-radius:4px; background-color:#dd4b39; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  617.           echo ".scButton_google_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#dd4b39; border-style:solid; border-radius:4px; background-color:#dd4b39; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  618.           echo ".scButton_google_list { filter: alpha(opacity=100); opacity:1;  }";
  619.           echo ".scButton_google_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  620.           echo ".scButton_icons { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:12px; cursor:pointer; transition:all 0.2s;  }";
  621.           echo ".scButton_icons:hover { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#727cf4; border-style:solid; border-radius:4px; background-color:#727cf4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:12px; cursor:pointer; transition:all 0.2s;  }";
  622.           echo ".scButton_icons:active { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:12px; cursor:pointer; transition:all 0.2s;  }";
  623.           echo ".scButton_icons_disabled { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:12px; cursor:default; transition:all 0.2s;  }";
  624.           echo ".scButton_icons_selected { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:12px; cursor:pointer; transition:all 0.2s;  }";
  625.           echo ".scButton_icons_list { filter: alpha(opacity=100); opacity:1;  }";
  626.           echo ".scButton_icons_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  627.           echo ".scButton_ok { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#0acf97; border-style:solid; border-radius:4px; background-color:#0acf97; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  628.           echo ".scButton_ok:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#1abf90; border-style:solid; border-radius:4px; background-color:#1abf90; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  629.           echo ".scButton_ok:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#00ab7a; border-style:solid; border-radius:4px; background-color:#00ab7a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  630.           echo ".scButton_ok_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#0acf97; border-style:solid; border-radius:4px; background-color:#0acf97; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  631.           echo ".scButton_ok_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#00ab7a; border-style:solid; border-radius:4px; background-color:#00ab7a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  632.           echo ".scButton_ok_list { filter: alpha(opacity=100); opacity:1;  }";
  633.           echo ".scButton_ok_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  634.           echo ".scButton_paypal { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2185d0; border-style:solid; border-radius:4px; background-color:#2185d0; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  635.           echo ".scButton_paypal:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#1678c2; border-style:solid; border-radius:4px; background-color:#1678c2; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  636.           echo ".scButton_paypal:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#1a69a4; border-style:solid; border-radius:4px; background-color:#1a69a4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  637.           echo ".scButton_paypal_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2185d0; border-style:solid; border-radius:4px; background-color:#2185d0; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  638.           echo ".scButton_paypal_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2185d0; border-style:solid; border-radius:4px; background-color:#2185d0; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  639.           echo ".scButton_paypal_list { filter: alpha(opacity=100); opacity:1;  }";
  640.           echo ".scButton_paypal_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  641.           echo ".scButton_small { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  642.           echo ".scButton_small:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#727cf4; border-style:solid; border-radius:4px; background-color:#727cf4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  643.           echo ".scButton_small:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  644.           echo ".scButton_small_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=50); opacity:0.5; padding:3px 13px; cursor:default;  }";
  645.           echo ".scButton_small_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  646.           echo ".scButton_small_list { filter: alpha(opacity=100); opacity:1;  }";
  647.           echo ".scButton_small_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  648.           echo ".scButton_sweetalertcancel { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#aaa; border-style:solid; border-radius:4.25px; background-color:#aaa; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  649.           echo ".scButton_sweetalertcancel:hover { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#999; border-style:solid; border-radius:4.25px; background-color:#999; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  650.           echo ".scButton_sweetalertcancel:active { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#3085d6; border-style:solid; border-radius:4.25px; background-color:#3085d6; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  651.           echo ".scButton_sweetalertcancel_disabled { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#aaa; border-style:solid; border-radius:4.25px; background-color:#aaa; box-shadow:none; filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  652.           echo ".scButton_sweetalertcancel_selected { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#7a7a7a; border-style:solid; border-radius:4.25px; background-color:#7a7a7a; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  653.           echo ".scButton_sweetalertcancel_list { filter: alpha(opacity=100); opacity:1;  }";
  654.           echo ".scButton_sweetalertcancel_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  655.           echo ".scButton_sweetalertok { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#3085d6; border-style:solid; border-radius:4.25px; background-color:#3085d6; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  656.           echo ".scButton_sweetalertok:hover { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#2b77c0; border-style:solid; border-radius:4.25px; background-color:#2b77c0; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  657.           echo ".scButton_sweetalertok:active { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#266aab; border-style:solid; border-radius:4.25px; background-color:#266aab; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  658.           echo ".scButton_sweetalertok_disabled { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#3085d6; border-style:solid; border-radius:4.25px; background-color:#3085d6; box-shadow:none; filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  659.           echo ".scButton_sweetalertok_selected { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#266aab; border-style:solid; border-radius:4.25px; background-color:#266aab; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  660.           echo ".scButton_sweetalertok_list { filter: alpha(opacity=100); opacity:1;  }";
  661.           echo ".scButton_sweetalertok_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  662.           echo ".scButton_twitter { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#55acee; border-style:solid; border-radius:4px; background-color:#55acee; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  663.           echo ".scButton_twitter:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#35a2f4; border-style:solid; border-radius:4px; background-color:#35a2f4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  664.           echo ".scButton_twitter:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2795e9; border-style:solid; border-radius:4px; background-color:#2795e9; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  665.           echo ".scButton_twitter_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#55acee; border-style:solid; border-radius:4px; background-color:#55acee; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  666.           echo ".scButton_twitter_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#55acee; border-style:solid; border-radius:4px; background-color:#55acee; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  667.           echo ".scButton_twitter_list { filter: alpha(opacity=100); opacity:1;  }";
  668.           echo ".scButton_twitter_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  669.           echo ".scButton_youtube { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:red; border-style:solid; border-radius:4px; background-color:red; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  670.           echo ".scButton_youtube:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#e60000; border-style:solid; border-radius:4px; background-color:#e60000; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  671.           echo ".scButton_youtube:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#c00; border-style:solid; border-radius:4px; background-color:#c00; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  672.           echo ".scButton_youtube_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:red; border-style:solid; border-radius:4px; background-color:red; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  673.           echo ".scButton_youtube_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:red; border-style:solid; border-radius:4px; background-color:red; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  674.           echo ".scButton_youtube_list { filter: alpha(opacity=100); opacity:1;  }";
  675.           echo ".scButton_youtube_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  676.           echo ".scButton_sc_image {  }";
  677.           echo ".scButton_sc_image:hover {  }";
  678.           echo ".scButton_sc_image:active {  }";
  679.           echo ".scButton_sc_image_disabled {  }";
  680.           echo ".scLink_default { text-decoration: underline; font-size: 13px; color: #1a0dab;  }";
  681.           echo ".scLink_default:visited { text-decoration: underline; font-size: 13px; color: #660099;  }";
  682.           echo ".scLink_default:active { text-decoration: underline; font-size: 13px; color: #1a0dab;  }";
  683.           echo ".scLink_default:hover { text-decoration: underline; font-size: 13px; color: #1a0dab;  }";
  684.           echo "</style>";
  685.           echo "<table width=\"80%\" border=\"1\" height=\"117\">";
  686.           echo "<tr>";
  687.           echo "   <td bgcolor=\"\">";
  688.           echo "       <b><font size=\"4\">" $this->Nm_lang['lang_errm_cmlb_nfnd'] . "</font>";
  689.           echo "  " $this->root $this->path_prod;
  690.           echo "   </b></td>";
  691.           echo " </tr>";
  692.           echo "</table>";
  693.           if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_menu'] && (!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan']) || !$_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan'])) 
  694.           { 
  695.               if (isset($_SESSION['scriptcase']['nm_sc_retorno']) && !empty($_SESSION['scriptcase']['nm_sc_retorno'])) 
  696.               { 
  697.                $btn_value "" $this->Ini->Nm_lang['lang_btns_back'] . "";
  698.                if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($btn_value))
  699.                {
  700.                    $btn_value sc_convert_encoding($btn_value$_SESSION['scriptcase']['charset'], "UTF-8");
  701.                }
  702.                $btn_hint "" $this->Ini->Nm_lang['lang_btns_back_hint'] . "";
  703.                if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($btn_hint))
  704.                {
  705.                    $btn_hint sc_convert_encoding($btn_hint$_SESSION['scriptcase']['charset'], "UTF-8");
  706.                }
  707. ?>
  708.                    <input type="button" id="sai" onClick="window.location='<?php echo $_SESSION['scriptcase']['nm_sc_retorno'?>'; return false" class="scButton_default" value="<?php echo $btn_value ?>" title="<?php echo $btn_hint ?>" style="vertical-align: middle;">

  709. <?php
  710.               } 
  711.               else 
  712.               { 
  713.                $btn_value "" $this->Ini->Nm_lang['lang_btns_exit'] . "";
  714.                if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($btn_value))
  715.                {
  716.                    $btn_value sc_convert_encoding($btn_value$_SESSION['scriptcase']['charset'], "UTF-8");
  717.                }
  718.                $btn_hint "" $this->Ini->Nm_lang['lang_btns_exit_hint'] . "";
  719.                if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($btn_hint))
  720.                {
  721.                    $btn_hint sc_convert_encoding($btn_hint$_SESSION['scriptcase']['charset'], "UTF-8");
  722.                }
  723. ?>
  724.                    <input type="button" id="sai" onClick="window.location='<?php echo $nm_url_saida ?>'; return false" class="scButton_danger" value="<?php echo $btn_value ?>" title="<?php echo $btn_hint ?>" style="vertical-align: middle;">

  725. <?php
  726.               } 
  727.           } 
  728.           exit ;
  729.       }

  730.       $this->nm_ger_css_emb true;
  731.       $this->Control_Css    "coo";
  732.       $this->path_atual     getcwd();
  733.       $opsys strtolower(php_uname());

  734.       $this->nm_cont_lin           0;
  735.       $this->nm_limite_lin         0;
  736.       $this->nm_limite_lin_prt     0;
  737.       $this->nm_limite_lin_res     0;
  738.       $this->nm_limite_lin_res_prt 0;
  739. // 
  740.       include_once($this->path_aplicacao "grid_new_erro.class.php"); 
  741.       $this->Erro = new grid_new_erro();
  742.       include_once($this->path_adodb "/adodb.inc.php"); 
  743.       $this->sc_Include($this->path_libs "/nm_sec_prod.php""F""nm_reg_prod") ; 
  744.       $this->sc_Include($this->path_libs "/nm_ini_perfil.php""F""perfil_lib") ; 
  745. // 
  746.  if(function_exists('set_php_timezone')) set_php_timezone('grid_new'); 
  747. // 
  748.       $this->sc_Include($this->path_lib_php "/nm_functions.php""""") ; 
  749.       $this->sc_Include($this->path_lib_php "/nm_api.php""""") ; 
  750.       $this->sc_Include($this->path_lib_php "/nm_edit.php""F""nmgp_Form_Num_Val") ; 
  751.       $this->sc_Include($this->path_lib_php "/nm_conv_dados.php""F""nm_conv_limpa_dado") ; 
  752.       $this->sc_Include($this->path_lib_php "/nm_data.class.php""C""nm_data") ; 
  753.       $this->nm_data = new nm_data("en_us");
  754.       include("../_lib/css/" $this->str_schema_all "_grid.php");
  755.       $this->Tree_img_col    trim($str_tree_col);
  756.       $this->Tree_img_exp    trim($str_tree_exp);
  757.       $this->Tree_img_type   "kie";
  758.       $_SESSION['scriptcase']['nmamd'] = array();
  759.       perfil_lib($this->path_libs);
  760.       if (!isset($_SESSION['sc_session'][$this->sc_page]['SC_Check_Perfil']))
  761.       {
  762.           if(function_exists("nm_check_perfil_exists")) nm_check_perfil_exists($this->path_libs$this->path_prod);
  763.           $_SESSION['sc_session'][$this->sc_page]['SC_Check_Perfil'] = true;
  764.       }
  765.       if (function_exists("nm_check_pdf_server")) $this->server_pdf nm_check_pdf_server($this->path_libs$this->server_pdf);
  766.       if (!isset($_SESSION['scriptcase']['sc_num_img']))
  767.       { 
  768.           $_SESSION['scriptcase']['sc_num_img'] = 1;
  769.       } 
  770.       $this->str_google_fonts= isset($str_google_fonts)?$str_google_fonts:'';
  771.       $this->regionalDefault();
  772.       $this->Str_btn_grid    trim($str_button) . "/" trim($str_button) . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".php";
  773.       $this->Str_btn_css     trim($str_button) . "/" trim($str_button) . ".css";
  774.       include($this->path_btn $this->Str_btn_grid);
  775.       $_SESSION['scriptcase']['erro']['str_schema_dir'] = $this->str_schema_all "_error" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
  776.       $this->sc_tem_trans_banco false;
  777.       if (isset($_SESSION['scriptcase']['grid_new']['session_timeout']['redir'])) {
  778.           $SS_cod_html  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  779.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">';
  780.           $SS_cod_html .= "<HTML>\r\n";
  781.           $SS_cod_html .= " <HEAD>\r\n";
  782.           $SS_cod_html .= "  <TITLE></TITLE>\r\n";
  783.           $SS_cod_html .= "   <META http-equiv=\"Content-Type\" content=\"text/html; charset=" $_SESSION['scriptcase']['charset_html'] . "\"/>\r\n";
  784.           if ($_SESSION['scriptcase']['proc_mobile']) {
  785.               $SS_cod_html .= "   <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\"/>\r\n";
  786.           }
  787.           $SS_cod_html .= "   <META http-equiv=\"Expires\" content=\"Fri, Jan 01 1900 00:00:00 GMT\"/>\r\n";
  788.           $SS_cod_html .= "    <META http-equiv=\"Pragma\" content=\"no-cache\"/>\r\n";
  789.           if ($_SESSION['scriptcase']['grid_new']['session_timeout']['redir_tp'] == "R") {
  790.               $SS_cod_html .= "  </HEAD>\r\n";
  791.               $SS_cod_html .= "   <body>\r\n";
  792.           }
  793.           else {
  794.               $SS_cod_html .= "    <link rel=\"shortcut icon\" href=\"../_lib/img/scriptcase__NM__ico__NM__favicon.ico\">\r\n";
  795.               $SS_cod_html .= "    <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" $this->str_schema_all "_grid.css\"/>\r\n";
  796.               $SS_cod_html .= "    <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/css/" $this->str_schema_all "_grid" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css\"/>\r\n";
  797.               $SS_cod_html .= "  </HEAD>\r\n";
  798.               $SS_cod_html .= "   <body class=\"scGridPage\">\r\n";
  799.               $SS_cod_html .= "    <table align=\"center\"><tr><td style=\"padding: 0\"><div class=\"scGridBorder\">\r\n";
  800.               $SS_cod_html .= "    <table class=\"scGridTabela\" width='100%' cellspacing=0 cellpadding=0><tr class=\"scGridFieldOdd\"><td class=\"scGridFieldOddFont\" style=\"padding: 15px 30px; text-align: center\">\r\n";
  801.               $SS_cod_html .= $this->Nm_lang['lang_errm_expired_session'] . "\r\n";
  802.               $SS_cod_html .= "     <form name=\"Fsession_redir\" method=\"post\"\r\n";
  803.               $SS_cod_html .= "           target=\"_self\">\r\n";
  804.               $SS_cod_html .= "           <input type=\"button\" name=\"sc_sai_seg\" value=\"OK\" onclick=\"sc_session_redir('" $_SESSION['scriptcase']['grid_new']['session_timeout']['redir'] . "');\">\r\n";
  805.               $SS_cod_html .= "     </form>\r\n";
  806.               $SS_cod_html .= "    </td></tr></table>\r\n";
  807.               $SS_cod_html .= "    </div></td></tr></table>\r\n";
  808.           }
  809.           $SS_cod_html .= "    <script type=\"text/javascript\">\r\n";
  810.           if ($_SESSION['scriptcase']['grid_new']['session_timeout']['redir_tp'] == "R") {
  811.               $SS_cod_html .= "      sc_session_redir('" $_SESSION['scriptcase']['grid_new']['session_timeout']['redir'] . "');\r\n";
  812.           }
  813.           $SS_cod_html .= "      function sc_session_redir(url_redir)\r\n";
  814.           $SS_cod_html .= "      {\r\n";
  815.           $SS_cod_html .= "         if (window.parent && window.parent.document != window.document && typeof window.parent.sc_session_redir === 'function')\r\n";
  816.           $SS_cod_html .= "         {\r\n";
  817.           $SS_cod_html .= "            window.parent.sc_session_redir(url_redir);\r\n";
  818.           $SS_cod_html .= "         }\r\n";
  819.           $SS_cod_html .= "         else\r\n";
  820.           $SS_cod_html .= "         {\r\n";
  821.           $SS_cod_html .= "             if (window.opener && typeof window.opener.sc_session_redir === 'function')\r\n";
  822.           $SS_cod_html .= "             {\r\n";
  823.           $SS_cod_html .= "                 window.close();\r\n";
  824.           $SS_cod_html .= "                 window.opener.sc_session_redir(url_redir);\r\n";
  825.           $SS_cod_html .= "             }\r\n";
  826.           $SS_cod_html .= "             else\r\n";
  827.           $SS_cod_html .= "             {\r\n";
  828.           $SS_cod_html .= "                 window.location = url_redir;\r\n";
  829.           $SS_cod_html .= "             }\r\n";
  830.           $SS_cod_html .= "         }\r\n";
  831.           $SS_cod_html .= "      }\r\n";
  832.           $SS_cod_html .= "    </script>\r\n";
  833.           $SS_cod_html .= " </body>\r\n";
  834.           $SS_cod_html .= "</HTML>\r\n";
  835.           unset($_SESSION['scriptcase']['grid_new']['session_timeout']);
  836.           unset($_SESSION['sc_session']);
  837.       }
  838.       if (isset($SS_cod_html) && isset($_GET['nmgp_opcao']) && (substr($_GET['nmgp_opcao'], 014) == "ajax_aut_comp_" || substr($_GET['nmgp_opcao'], 013) == "ajax_autocomp"))
  839.       {
  840.           unset($_SESSION['sc_session']);
  841.           $oJson = new Services_JSON();
  842.           echo $oJson->encode("ss_time_out");
  843.           exit;
  844.       }
  845.       elseif (isset($SS_cod_html) && ((isset($_POST['nmgp_opcao']) && substr($_POST['nmgp_opcao'], 05) == "ajax_") || (isset($_GET['nmgp_opcao']) && substr($_GET['nmgp_opcao'], 05) == "ajax_")))
  846.       {
  847.           unset($_SESSION['sc_session']);
  848.           $this->Arr_result = array();
  849.           $this->Arr_result['ss_time_out'] = true;
  850.           $oJson = new Services_JSON();
  851.           echo $oJson->encode($this->Arr_result);
  852.           exit;
  853.       }
  854.       elseif (isset($SS_cod_html))
  855.       {
  856.           echo $SS_cod_html;
  857.           exit;
  858.       }
  859.       $this->nm_bases_access     = array("access""ado_access""ace_access");
  860.       $this->nm_bases_db2        = array("db2""db2_odbc""odbc_db2""odbc_db2v6""pdo_db2_odbc""pdo_ibm");
  861.       $this->nm_bases_ibase      = array("ibase""firebird""pdo_firebird""borland_ibase");
  862.       $this->nm_bases_informix   = array("informix""informix72""pdo_informix");
  863.       $this->nm_bases_mssql      = array("mssql""ado_mssql""adooledb_mssql""odbc_mssql""mssqlnative""pdo_sqlsrv""pdo_dblib");
  864.       $this->nm_bases_mysql      = array("mysql""mysqlt""mysqli""maxsql""pdo_mysql");
  865.       $this->nm_bases_postgres   = array("postgres""postgres64""postgres7""pdo_pgsql");
  866.       $this->nm_bases_oracle     = array("oci8""oci805""oci8po""odbc_oracle""oracle""pdo_oracle");
  867.       $this->sqlite_version      "old";
  868.       $this->nm_bases_sqlite     = array("sqlite""sqlite3""pdosqlite");
  869.       $this->nm_bases_sybase     = array("sybase""pdo_sybase_odbc""pdo_sybase_dblib");
  870.       $this->nm_bases_vfp        = array("vfp");
  871.       $this->nm_bases_odbc       = array("odbc");
  872.       $this->nm_bases_progress     = array("progress""pdo_progress_odbc");
  873.       $this->nm_bases_all        array_merge($this->nm_bases_access$this->nm_bases_db2$this->nm_bases_ibase$this->nm_bases_informix$this->nm_bases_mssql$this->nm_bases_mysql$this->nm_bases_postgres$this->nm_bases_oracle$this->nm_bases_sqlite$this->nm_bases_sybase$this->nm_bases_vfp$this->nm_bases_odbc$this->nm_bases_progress);
  874.       $this->nm_font_ttf = array("ar""ja""pl""ru""sk""thai""zh_cn""zh_hk""cz""el""ko""mk");
  875.       $this->nm_ttf_arab = array("ar");
  876.       $this->nm_ttf_jap  = array("ja");
  877.       $this->nm_ttf_rus  = array("pl""ru""sk""cz""el""mk");
  878.       $this->nm_ttf_thai = array("thai");
  879.       $this->nm_ttf_chi  = array("zh_cn""zh_hk""ko");
  880.       $_SESSION['sc_session'][$this->sc_page]['grid_new']['seq_dir'] = 0
  881.       $_SESSION['sc_session'][$this->sc_page]['grid_new']['sub_dir'] = array(); 
  882.       $_SESSION['scriptcase']['nm_bases_security']  = "enc_nm_enc_v1D9XsZSBiDSN7HQBqDMNOVcFeV5F/DoBiHQXOVIJsHArYHQraDMBYZSJGHEFqVoJwDcBiDQB/HAveV5FUHgrwDkBsDWXCDoJsDcBwH9B/Z1rYHQJwHgveVkJ3DWF/VoBiDcJUZSX7Z1BYHuFaDMzGVcrsDWXCHMFGDcBqZkFGHIBeHuFaHgrKZSXeV5XKDoBqD9XsDQJwHANKVWXGHgvsV9FeHEX/VErqHQJmZ1F7Z1vmD5rqDEBOHArCDWF/VoFaDcBwDQX7Z1BYV5JwDMvmVcFKV5BmVoBqD9BsZkFGHAvsD5FaDMzGZSJGDWr/VoXGDcBwDQB/Z1rwD5NUHgrKVcFCDuFGDoJsD9XOZ1F7HIveD5BqHgBeHEFiV5B3DoF7D9XsDuFaHAveHQJwHuBOVcFKH5XKVoX7HQNmZ1FaHIveHuBqHgNKHEXeDWXCVoX7HQJKDQJsZ1vCV5FGHuNOV9FeDWXCHIF7HQBqVINUDSrYHuFaHgBOVkJqDWFqHIBiHQXGDQFUHAN7HuNUHgrwVcB/DWJeHIJeHQFYZ1BOHAvmZMFaDMveHENiDuFaHMBqHQXGDuBqD1NKVWXGHgrwZSNiDWF/HIrqDcBwH9B/HIrwV5JeDMBYDkBsH5FYHMBqHQJeZ9XGHIrwHuJeHgrwV9FeH5B7VErqHQFYZkFGDSBeHQJeHgNKHErsDuXKZuFaHQXGDuFaZ1vCVWXGHgrwVcXKDuX7HMFGHQFYZ1BOHANOHQJeHgNOHENiDWr/HINUDcJUZSX7HIBeD5BqHgvsZSJ3H5FqHIF7HQBqZSBqDSBOZMXGHgvsHErsDWFqHIFUHQXGDuFaD1BeHuF7DMNOV9FeV5FYHIBiHQFYZkBiHANOHQBqHgvsHErsDuXKZuFaHQXGDQFUHIrwHuJeDMzGVcBUDWrmVENUDcBwH9B/HIrwV5JeDMBYDkBsH5FYHMBqHQJeZ9XGD1NKV5BODMBOVIBsDWJeHIFUHQFYZkBiHArYHuX7HgNOZSJ3DurmZuJeHQXGDQFUHIvsV5BODMBYVcBUH5B3VEFGHQFYZkFGD1rwHuFaHgveVkJ3DuX/ZuB/DcJUZSX7HIBeD5BqHgvsZSJ3H5B7DoBiHQNGVIraDSvmD5raHgrKHEXeDWB3DoNUD9XsDQFGHABYD5rqHuBYVcFKHEFYVorqD9BsZ1F7D1zGD5raHgrKHArCH5F/DoXGDcJUDQJsHArYV5BOHgrKV9FiDWXCVoFGD9JmZ1F7Z1BeZMBODEBODkFeDuX/DoNUD9FYDQX7Z1rwVWJwHgNKVcFKH5FqVoB/D9BsVIraHArKZMFaDErKZSXeH5FGDoNUDcBwDQX7DSBYVWJsHuvmVcFKDWFYVoX7DcBwZ1F7Z1BeV5BqDMrYHEBUH5F/VoJeDcBwDQX7Z1zGV5BiHgrKVIBOV5X7VoX7DcBwZ1F7HIrwV5JeDMBYZSXeDWFqVoBiD9NwZSX7DSBYD5NUHgrKZSJ3V5BmVoBqD9BsZ1F7DSrYD5rqDMrYZSJ3HEB7ZuJsDcXGZSFUHANOHuFUHgrwVIB/DWrmDoXGDcFYH9BOHABYHuFGDMvCHErCDWB3VoFGDcBiH9BiHIrwHQXGDMvmZSJqH5B7DoXGHQBsVINUD1rwHQNUDMvCVkJ3HEB3DoF7D9XsDQJsDSBYV5FGHgNKDkFCH5FqVoBqDcNwH9FaHArKD5NUDEvsHEFiDuJeDoFUHQXGZSBiHArYV5JeHuzGVcFKDuFqDoFGDcBqH9B/HABYZMB/DEBeHEXeV5FaVoBiD9NwZ9rqZ1rwHQF7HgvsDkFCDWJeDoFGD9XOZ1rqD1rKD5rqDMBYHEJGH5FYVoB/HQXGZSFGHAvCVWBqDMrwVcFCDWXCDoX7D9XOZ1BiHIBOD5JeHgvCZSJGDuFaZuBqD9NmZSFGHANOV5JwHuNODkFCH5B3VoraD9XOH9B/D1rwD5XGDEBeHEJGDWF/ZuFaDcJeZSX7HArYV5BqHgrKV9FiV5FGVoBqD9BsZ1F7DSrYD5rqDMrYZSJGH5FYDoF7DcXOZSX7HIrKV5JwHuzGDkFCH5XCVoJwHQBiZ1B/HABYD5rqHgBeVkXeV5FaDoB/D9JKZ9rqZ1BYHuB/HuvmVcFCDWrmDoXGDcJUZ1F7D1zGV5X7HgBeHEXeV5XCDoraHQXGH9X7HIBeV5JwHgvsDkBODWFaDoJeHQJmZ1F7Z1vmD5rqDEBOHArCDWBmDoJeHQBiDQBqHAvmV5JeDMvOVcBUDWrmVorqHQNwH9BqHArKV5FUDMrYZSXeV5FqHIJsHQFYZSFUDSBYVWJwHgvOV9FiV5X/VorqHQNmZ1FaHArKV5FGHgBYHEJGDWX7HMBqHQJKDQJsZ1vCV5FGHuNOV9FeDWXCDoNUDcJUZ1B/Z1rYD5FaHgBeHEFiV5B3DoF7D9XsDuFaHANKVWBqDMrwZSNiDWB3VEB/";
  883.       $this->prep_conect();
  884.       $this->conectDB();
  885.       if (!in_array(strtolower($this->nm_tpbanco), $this->nm_bases_all))
  886.       {
  887.           echo "<tr>";
  888.           echo "   <td bgcolor=\"\">";
  889.           echo "       <b><font size=\"4\">" $this->Nm_lang['lang_errm_dbcn_nspt'] . "</font>";
  890.           echo "  " $perfil_trab;
  891.           echo "   </b></td>";
  892.           echo " </tr>";
  893.           echo "</table>";
  894.           if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_menu'] && (!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan']) || !$_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan'])) 
  895.           { 
  896.               if (isset($_SESSION['scriptcase']['nm_sc_retorno']) && !empty($_SESSION['scriptcase']['nm_sc_retorno'])) 
  897.               { 
  898.                   echo "<a href='" $_SESSION['scriptcase']['nm_sc_retorno'] . "' target='_self'><img border='0' src='" $this->path_botoes "/nm_scriptcase9_Midnight_bvoltar.gif' title='" $this->Nm_lang['lang_btns_rtrn_scrp_hint'] . "' align=absmiddle></a> \n" 
  899.               } 
  900.               else 
  901.               { 
  902.                   echo "<a href='$nm_url_saida' target='_self'><img border='0' src='" $this->path_botoes "/nm_scriptcase9_Midnight_bsair.gif' title='" $this->Nm_lang['lang_btns_exit_appl_hint'] . "' align=absmiddle></a> \n" 
  903.               } 
  904.           } 
  905.           exit ;
  906.       } 
  907.       if (empty($this->nm_tabela))
  908.       {
  909.           $this->nm_tabela "Proprietarios INNER JOIN Veiculos ON Proprietarios.idProprietario = Veiculos.idProprietario_fk"
  910.       }
  911.    }

  912.    function getRunningOS()
  913.    {
  914.        $aOSInfo = array();

  915.        if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  916.        {
  917.            $aOSInfo['os'] = 'win';
  918.        }
  919.        elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  920.        {
  921.            $aOSInfo['os'] = 'linux-i386';
  922.            if(strpos(strtolower(php_uname()), 'x86_64') !== FALSE
  923.             {
  924.                $aOSInfo['os'] = 'linux-amd64';
  925.             }
  926.        }
  927.        elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  928.        {
  929.            $aOSInfo['os'] = 'macos';
  930.        }

  931.        return $aOSInfo;
  932.    }

  933.    function prep_conect()
  934.    {
  935.       if (isset($_SESSION['scriptcase']['sc_connection']) && !empty($_SESSION['scriptcase']['sc_connection']))
  936.       {
  937.           foreach ($_SESSION['scriptcase']['sc_connection'] as $NM_con_orig => $NM_con_dest)
  938.           {
  939.               if (isset($_SESSION['scriptcase']['grid_new']['glo_nm_conexao']) && $_SESSION['scriptcase']['grid_new']['glo_nm_conexao'] == $NM_con_orig)
  940.               {
  941. /*NM*/            $_SESSION['scriptcase']['grid_new']['glo_nm_conexao'] = $NM_con_dest;
  942.               }
  943.               if (isset($_SESSION['scriptcase']['grid_new']['glo_nm_perfil']) && $_SESSION['scriptcase']['grid_new']['glo_nm_perfil'] == $NM_con_orig)
  944.               {
  945. /*NM*/            $_SESSION['scriptcase']['grid_new']['glo_nm_perfil'] = $NM_con_dest;
  946.               }
  947.               if (isset($_SESSION['scriptcase']['grid_new']['glo_con_' $NM_con_orig]))
  948.               {
  949.                   $_SESSION['scriptcase']['grid_new']['glo_con_' $NM_con_orig] = $NM_con_dest;
  950.               }
  951.           }
  952.       }
  953.       $con_devel             = (isset($_SESSION['scriptcase']['grid_new']['glo_nm_conexao'])) ? $_SESSION['scriptcase']['grid_new']['glo_nm_conexao'] : ""
  954.       $perfil_trab           ""
  955.       $this->nm_falta_var    ""
  956.       $this->nm_falta_var_db ""
  957.       $nm_crit_perfil        false;
  958.       if (isset($_SESSION['scriptcase']['grid_new']['glo_nm_conexao']) && !empty($_SESSION['scriptcase']['grid_new']['glo_nm_conexao']))
  959.       {
  960.           ob_start();
  961.           db_conect_devel($con_devel$this->root $this->path_prod'Projeto7'2); 
  962.           if (!isset($this->Ajax_result_set)) {$this->Ajax_result_set ob_get_contents();}
  963.           ob_end_clean();
  964.           if (empty($_SESSION['scriptcase']['glo_tpbanco']) && empty($_SESSION['scriptcase']['glo_banco']))
  965.           {
  966.               $nm_crit_perfil true;
  967.           }
  968.       }
  969.       if (isset($_SESSION['scriptcase']['grid_new']['glo_nm_perfil']) && !empty($_SESSION['scriptcase']['grid_new']['glo_nm_perfil']))
  970.       {
  971.           $perfil_trab $_SESSION['scriptcase']['grid_new']['glo_nm_perfil'];
  972.       }
  973.       elseif (isset($_SESSION['scriptcase']['glo_perfil']) && !empty($_SESSION['scriptcase']['glo_perfil']))
  974.       {
  975.           $perfil_trab $_SESSION['scriptcase']['glo_perfil'];
  976.       }
  977.       if (!empty($perfil_trab))
  978.       {
  979.           $_SESSION['scriptcase']['glo_senha_protect'] = "";
  980.           carrega_perfil($perfil_trab$this->path_libs"S"$this->path_conf);
  981.           if (empty($_SESSION['scriptcase']['glo_senha_protect']))
  982.           {
  983.               $nm_crit_perfil true;
  984.           }
  985.       }
  986.       else
  987.       {
  988.           $perfil_trab $con_devel;
  989.       }
  990.       if (!isset($_SESSION['sc_session'][$this->sc_page]['grid_new']['embutida_init']) || !$_SESSION['sc_session'][$this->sc_page]['grid_new']['embutida_init']) 
  991.       {
  992.       }
  993. // 
  994.       if (!isset($_SESSION['scriptcase']['glo_tpbanco']))
  995.       {
  996.           if (!$nm_crit_perfil)
  997.           {
  998.               $this->nm_falta_var_db .= "glo_tpbanco; ";
  999.           }
  1000.       }
  1001.       else
  1002.       {
  1003.           $this->nm_tpbanco $_SESSION['scriptcase']['glo_tpbanco']; 
  1004.       }
  1005.       if (!isset($_SESSION['scriptcase']['glo_servidor']))
  1006.       {
  1007.           if (!$nm_crit_perfil)
  1008.           {
  1009.               $this->nm_falta_var_db .= "glo_servidor; ";
  1010.           }
  1011.       }
  1012.       else
  1013.       {
  1014.           $this->nm_servidor $_SESSION['scriptcase']['glo_servidor']; 
  1015.       }
  1016.       if (!isset($_SESSION['scriptcase']['glo_banco']))
  1017.       {
  1018.           if (!$nm_crit_perfil)
  1019.           {
  1020.               $this->nm_falta_var_db .= "glo_banco; ";
  1021.           }
  1022.       }
  1023.       else
  1024.       {
  1025.           $this->nm_banco $_SESSION['scriptcase']['glo_banco']; 
  1026.       }
  1027.       if (!isset($_SESSION['scriptcase']['glo_usuario']))
  1028.       {
  1029.           if (!$nm_crit_perfil)
  1030.           {
  1031.               $this->nm_falta_var_db .= "glo_usuario; ";
  1032.           }
  1033.       }
  1034.       else
  1035.       {
  1036.           $this->nm_usuario $_SESSION['scriptcase']['glo_usuario']; 
  1037.       }
  1038.       if (!isset($_SESSION['scriptcase']['glo_senha']))
  1039.       {
  1040.           if (!$nm_crit_perfil)
  1041.           {
  1042.               $this->nm_falta_var_db .= "glo_senha; ";
  1043.           }
  1044.       }
  1045.       else
  1046.       {
  1047.           $this->nm_senha $_SESSION['scriptcase']['glo_senha']; 
  1048.       }
  1049.       if (isset($_SESSION['scriptcase']['glo_database_encoding']))
  1050.       {
  1051.           $this->nm_database_encoding $_SESSION['scriptcase']['glo_database_encoding']; 
  1052.       }
  1053.       $this->nm_arr_db_extra_args = array(); 
  1054.       if (isset($_SESSION['scriptcase']['glo_use_ssl']))
  1055.       {
  1056.           $this->nm_arr_db_extra_args['use_ssl'] = $_SESSION['scriptcase']['glo_use_ssl']; 
  1057.       }
  1058.       if (isset($_SESSION['scriptcase']['glo_mysql_ssl_key']))
  1059.       {
  1060.           $this->nm_arr_db_extra_args['mysql_ssl_key'] = $_SESSION['scriptcase']['glo_mysql_ssl_key']; 
  1061.       }
  1062.       if (isset($_SESSION['scriptcase']['glo_mysql_ssl_cert']))
  1063.       {
  1064.           $this->nm_arr_db_extra_args['mysql_ssl_cert'] = $_SESSION['scriptcase']['glo_mysql_ssl_cert']; 
  1065.       }
  1066.       if (isset($_SESSION['scriptcase']['glo_mysql_ssl_capath']))
  1067.       {
  1068.           $this->nm_arr_db_extra_args['mysql_ssl_capath'] = $_SESSION['scriptcase']['glo_mysql_ssl_capath']; 
  1069.       }
  1070.       if (isset($_SESSION['scriptcase']['glo_mysql_ssl_ca']))
  1071.       {
  1072.           $this->nm_arr_db_extra_args['mysql_ssl_ca'] = $_SESSION['scriptcase']['glo_mysql_ssl_ca']; 
  1073.       }
  1074.       if (isset($_SESSION['scriptcase']['glo_mysql_ssl_cipher']))
  1075.       {
  1076.           $this->nm_arr_db_extra_args['mysql_ssl_cipher'] = $_SESSION['scriptcase']['glo_mysql_ssl_cipher']; 
  1077.       }
  1078.       if (isset($_SESSION['scriptcase']['glo_db2_autocommit']))
  1079.       {
  1080.           $this->nm_con_db2['db2_autocommit'] = $_SESSION['scriptcase']['glo_db2_autocommit']; 
  1081.       }
  1082.       if (isset($_SESSION['scriptcase']['glo_db2_i5_lib']))
  1083.       {
  1084.           $this->nm_con_db2['db2_i5_lib'] = $_SESSION['scriptcase']['glo_db2_i5_lib']; 
  1085.       }
  1086.       if (isset($_SESSION['scriptcase']['glo_db2_i5_naming']))
  1087.       {
  1088.           $this->nm_con_db2['db2_i5_naming'] = $_SESSION['scriptcase']['glo_db2_i5_naming']; 
  1089.       }
  1090.       if (isset($_SESSION['scriptcase']['glo_db2_i5_commit']))
  1091.       {
  1092.           $this->nm_con_db2['db2_i5_commit'] = $_SESSION['scriptcase']['glo_db2_i5_commit']; 
  1093.       }
  1094.       if (isset($_SESSION['scriptcase']['glo_db2_i5_query_optimize']))
  1095.       {
  1096.           $this->nm_con_db2['db2_i5_query_optimize'] = $_SESSION['scriptcase']['glo_db2_i5_query_optimize']; 
  1097.       }
  1098.       if (isset($_SESSION['scriptcase']['glo_use_persistent']))
  1099.       {
  1100.           $this->nm_con_persistente $_SESSION['scriptcase']['glo_use_persistent']; 
  1101.       }
  1102.       if (isset($_SESSION['scriptcase']['glo_use_schema']))
  1103.       {
  1104.           $this->nm_con_use_schema $_SESSION['scriptcase']['glo_use_schema']; 
  1105.       }
  1106.       $this->date_delim  "'";
  1107.       $this->date_delim1 "'";
  1108.       if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_sybase))
  1109.       {
  1110.           $this->date_delim  "";
  1111.           $this->date_delim1 "";
  1112.       }
  1113.       if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_access))
  1114.       {
  1115.           $this->date_delim  "#";
  1116.           $this->date_delim1 "#";
  1117.       }
  1118.       if (isset($_SESSION['scriptcase']['glo_decimal_db']) && !empty($_SESSION['scriptcase']['glo_decimal_db']))
  1119.       {
  1120.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['decimal_db'] = $_SESSION['scriptcase']['glo_decimal_db']; 
  1121.       }
  1122.       if (isset($_SESSION['scriptcase']['glo_date_separator']) && !empty($_SESSION['scriptcase']['glo_date_separator']))
  1123.       {
  1124.           $SC_temp trim($_SESSION['scriptcase']['glo_date_separator']);
  1125.           if (strlen($SC_temp) == 2)
  1126.           {
  1127.               $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date']  = substr($SC_temp01); 
  1128.               $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date1'] = substr($SC_temp11); 
  1129.           }
  1130.           else
  1131.            {
  1132.               $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date']  = $SC_temp
  1133.               $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date1'] = $SC_temp
  1134.           }
  1135.           $this->date_delim  $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date'];
  1136.           $this->date_delim1 $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date1'];
  1137.       }
  1138. // 
  1139.       if (!empty($this->nm_falta_var) || !empty($this->nm_falta_var_db) || $nm_crit_perfil)
  1140.       {
  1141.           echo "<style type=\"text/css\">";
  1142.           echo ".scButton_cancel { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1143.           echo ".scButton_cancel:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#f84d70; border-style:solid; border-radius:4px; background-color:#f84d70; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1144.           echo ".scButton_cancel:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#f23e63; border-style:solid; border-radius:4px; background-color:#f23e63; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1145.           echo ".scButton_cancel_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:3px 13px; cursor:default; transition:all 0.2s;  }";
  1146.           echo ".scButton_cancel_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1147.           echo ".scButton_cancel_list { filter: alpha(opacity=100); opacity:1;  }";
  1148.           echo ".scButton_cancel_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1149.           echo ".scButton_check { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#0acf97; border-style:solid; border-radius:4px; background-color:#0acf97; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1150.           echo ".scButton_check:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#1abf90; border-style:solid; border-radius:4px; background-color:#1abf90; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1151.           echo ".scButton_check:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#00ab7a; border-style:solid; border-radius:4px; background-color:#00ab7a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1152.           echo ".scButton_check_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#0acf97; border-style:solid; border-radius:4px; background-color:#0acf97; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=50); opacity:0.5; padding:3px 13px; cursor:default;  }";
  1153.           echo ".scButton_check_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#00ab7a; border-style:solid; border-radius:4px; background-color:#00ab7a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1154.           echo ".scButton_check_list { filter: alpha(opacity=100); opacity:1;  }";
  1155.           echo ".scButton_check_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1156.           echo ".scButton_danger { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1157.           echo ".scButton_danger:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#f84d70; border-style:solid; border-radius:4px; background-color:#f84d70; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1158.           echo ".scButton_danger:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#f23e63; border-style:solid; border-radius:4px; background-color:#f23e63; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1159.           echo ".scButton_danger_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=42); opacity:0.42; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  1160.           echo ".scButton_danger_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#fa5c7c; border-style:solid; border-radius:4px; background-color:#fa5c7c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1161.           echo ".scButton_danger_list { filter: alpha(opacity=100); opacity:1;  }";
  1162.           echo ".scButton_danger_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1163.           echo ".scButton_default { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1164.           echo ".scButton_default:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#727cf4; border-style:solid; border-radius:4px; background-color:#727cf4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1165.           echo ".scButton_default:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1166.           echo ".scButton_default_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  1167.           echo ".scButton_default_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1168.           echo ".scButton_default_list { background-color:#ffffff; filter: alpha(opacity=100); opacity:1; padding:6px 52px 6px 15px; cursor:pointer; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858;  }";
  1169.           echo ".scButton_default_list:hover { background-color:#EFF2F7; filter: alpha(opacity=100); opacity:1; padding:6px 52px 6px 15px; cursor:pointer; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858;  }";
  1170.           echo ".scButton_default_list_disabled { background-color:#ffffff; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858; padding:6px 52px 6px 15px; filter: alpha(opacity=45); opacity:0.45; cursor:default;  }";
  1171.           echo ".scButton_default_list_selected { background-color:#ffffff; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858; padding:6px 52px 6px 15px; cursor:pointer; filter: alpha(opacity=100); opacity:1;  }";
  1172.           echo ".scButton_default_list:active { background-color:#EFF2F7; filter: alpha(opacity=100); opacity:1; padding:6px 52px 6px 15px; cursor:pointer; font-family:Arial, sans-serif; font-size:13px; text-decoration:none; color:#3C4858;  }";
  1173.           echo ".scButton_facebook { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#3b5998; border-style:solid; border-radius:4px; background-color:#3b5998; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1174.           echo ".scButton_facebook:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#304d8a; border-style:solid; border-radius:4px; background-color:#304d8a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1175.           echo ".scButton_facebook:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2d4373; border-style:solid; border-radius:4px; background-color:#2d4373; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1176.           echo ".scButton_facebook_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#3b5998; border-style:solid; border-radius:4px; background-color:#3b5998; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  1177.           echo ".scButton_facebook_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:#3b5998; border-color:#3b5998; border-style:solid; border-radius:4px; background-color:#3b5998; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1178.           echo ".scButton_facebook_list { filter: alpha(opacity=100); opacity:1;  }";
  1179.           echo ".scButton_facebook_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1180.           echo ".scButton_fontawesome { color:#8592a6; font-size:15px; text-decoration:none; border-style:none; filter: alpha(opacity=100); opacity:1; padding:5px; cursor:pointer; transition:all 0.2s;  }";
  1181.           echo ".scButton_fontawesome:hover { color:#8592a6; font-size:15px; text-decoration:none; border-style:none; filter: alpha(opacity=100); opacity:1; padding:5px; cursor:pointer; transition:all 0.2s;  }";
  1182.           echo ".scButton_fontawesome:active { color:#8592a6; font-size:15px; text-decoration:none; filter: alpha(opacity=100); opacity:1; padding:5px; cursor:pointer; transition:all 0.2s;  }";
  1183.           echo ".scButton_fontawesome_disabled { color:#8592a6; font-size:15px; text-decoration:none; border-style:none; filter: alpha(opacity=44); opacity:0.44; padding:5px; cursor:default; transition:all 0.2s;  }";
  1184.           echo ".scButton_fontawesome_selected { color:#8592a6; font-size:15px; text-decoration:none; border-style:none; filter: alpha(opacity=100); opacity:1; padding:5px; cursor:pointer; transition:all 0.2s;  }";
  1185.           echo ".scButton_fontawesome_list { filter: alpha(opacity=100); opacity:1;  }";
  1186.           echo ".scButton_fontawesome_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1187.           echo ".scButton_google { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#dd4b39; border-style:solid; border-radius:4px; background-color:#dd4b39; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1188.           echo ".scButton_google:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#e0321c; border-style:solid; border-radius:4px; background-color:#e0321c; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1189.           echo ".scButton_google:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#c23321; border-style:solid; border-radius:4px; background-color:#c23321; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1190.           echo ".scButton_google_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#dd4b39; border-style:solid; border-radius:4px; background-color:#dd4b39; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  1191.           echo ".scButton_google_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#dd4b39; border-style:solid; border-radius:4px; background-color:#dd4b39; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1192.           echo ".scButton_google_list { filter: alpha(opacity=100); opacity:1;  }";
  1193.           echo ".scButton_google_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1194.           echo ".scButton_icons { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:12px; cursor:pointer; transition:all 0.2s;  }";
  1195.           echo ".scButton_icons:hover { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#727cf4; border-style:solid; border-radius:4px; background-color:#727cf4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:12px; cursor:pointer; transition:all 0.2s;  }";
  1196.           echo ".scButton_icons:active { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:12px; cursor:pointer; transition:all 0.2s;  }";
  1197.           echo ".scButton_icons_disabled { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:12px; cursor:default; transition:all 0.2s;  }";
  1198.           echo ".scButton_icons_selected { color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:12px; cursor:pointer; transition:all 0.2s;  }";
  1199.           echo ".scButton_icons_list { filter: alpha(opacity=100); opacity:1;  }";
  1200.           echo ".scButton_icons_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1201.           echo ".scButton_ok { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#0acf97; border-style:solid; border-radius:4px; background-color:#0acf97; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1202.           echo ".scButton_ok:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#1abf90; border-style:solid; border-radius:4px; background-color:#1abf90; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1203.           echo ".scButton_ok:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#00ab7a; border-style:solid; border-radius:4px; background-color:#00ab7a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1204.           echo ".scButton_ok_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#0acf97; border-style:solid; border-radius:4px; background-color:#0acf97; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  1205.           echo ".scButton_ok_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#00ab7a; border-style:solid; border-radius:4px; background-color:#00ab7a; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1206.           echo ".scButton_ok_list { filter: alpha(opacity=100); opacity:1;  }";
  1207.           echo ".scButton_ok_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1208.           echo ".scButton_paypal { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2185d0; border-style:solid; border-radius:4px; background-color:#2185d0; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1209.           echo ".scButton_paypal:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#1678c2; border-style:solid; border-radius:4px; background-color:#1678c2; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1210.           echo ".scButton_paypal:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#1a69a4; border-style:solid; border-radius:4px; background-color:#1a69a4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1211.           echo ".scButton_paypal_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2185d0; border-style:solid; border-radius:4px; background-color:#2185d0; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  1212.           echo ".scButton_paypal_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2185d0; border-style:solid; border-radius:4px; background-color:#2185d0; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1213.           echo ".scButton_paypal_list { filter: alpha(opacity=100); opacity:1;  }";
  1214.           echo ".scButton_paypal_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1215.           echo ".scButton_small { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1216.           echo ".scButton_small:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#727cf4; border-style:solid; border-radius:4px; background-color:#727cf4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1217.           echo ".scButton_small:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1218.           echo ".scButton_small_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#464f5b; border-style:solid; border-radius:4px; background-color:#464f5b; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=50); opacity:0.5; padding:3px 13px; cursor:default;  }";
  1219.           echo ".scButton_small_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#5966eb; border-style:solid; border-radius:4px; background-color:#5966eb; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:3px 13px; cursor:pointer; transition:all 0.2s;  }";
  1220.           echo ".scButton_small_list { filter: alpha(opacity=100); opacity:1;  }";
  1221.           echo ".scButton_small_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1222.           echo ".scButton_sweetalertcancel { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#aaa; border-style:solid; border-radius:4.25px; background-color:#aaa; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1223.           echo ".scButton_sweetalertcancel:hover { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#999; border-style:solid; border-radius:4.25px; background-color:#999; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1224.           echo ".scButton_sweetalertcancel:active { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#3085d6; border-style:solid; border-radius:4.25px; background-color:#3085d6; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1225.           echo ".scButton_sweetalertcancel_disabled { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#aaa; border-style:solid; border-radius:4.25px; background-color:#aaa; box-shadow:none; filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1226.           echo ".scButton_sweetalertcancel_selected { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#7a7a7a; border-style:solid; border-radius:4.25px; background-color:#7a7a7a; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1227.           echo ".scButton_sweetalertcancel_list { filter: alpha(opacity=100); opacity:1;  }";
  1228.           echo ".scButton_sweetalertcancel_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1229.           echo ".scButton_sweetalertok { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#3085d6; border-style:solid; border-radius:4.25px; background-color:#3085d6; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1230.           echo ".scButton_sweetalertok:hover { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#2b77c0; border-style:solid; border-radius:4.25px; background-color:#2b77c0; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1231.           echo ".scButton_sweetalertok:active { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#266aab; border-style:solid; border-radius:4.25px; background-color:#266aab; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1232.           echo ".scButton_sweetalertok_disabled { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#3085d6; border-style:solid; border-radius:4.25px; background-color:#3085d6; box-shadow:none; filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1233.           echo ".scButton_sweetalertok_selected { font-family:Arial, sans-serif; color:#fff; font-size:17px; font-weight:normal; text-decoration:none; border-width:0px; border-color:#266aab; border-style:solid; border-radius:4.25px; background-color:#266aab; box-shadow:none; filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1234.           echo ".scButton_sweetalertok_list { filter: alpha(opacity=100); opacity:1;  }";
  1235.           echo ".scButton_sweetalertok_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1236.           echo ".scButton_twitter { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#55acee; border-style:solid; border-radius:4px; background-color:#55acee; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1237.           echo ".scButton_twitter:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#35a2f4; border-style:solid; border-radius:4px; background-color:#35a2f4; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1238.           echo ".scButton_twitter:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#2795e9; border-style:solid; border-radius:4px; background-color:#2795e9; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1239.           echo ".scButton_twitter_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#55acee; border-style:solid; border-radius:4px; background-color:#55acee; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  1240.           echo ".scButton_twitter_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#55acee; border-style:solid; border-radius:4px; background-color:#55acee; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1241.           echo ".scButton_twitter_list { filter: alpha(opacity=100); opacity:1;  }";
  1242.           echo ".scButton_twitter_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1243.           echo ".scButton_youtube { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:red; border-style:solid; border-radius:4px; background-color:red; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1244.           echo ".scButton_youtube:hover { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#e60000; border-style:solid; border-radius:4px; background-color:#e60000; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1245.           echo ".scButton_youtube:active { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:#c00; border-style:solid; border-radius:4px; background-color:#c00; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1246.           echo ".scButton_youtube_disabled { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:red; border-style:solid; border-radius:4px; background-color:red; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=44); opacity:0.44; padding:9px 12px; cursor:default; transition:all 0.2s;  }";
  1247.           echo ".scButton_youtube_selected { font-family:'Nunito', sans-serif; color:#fff; font-size:13px; font-weight:normal; text-decoration:none; border-width:1px; border-color:red; border-style:solid; border-radius:4px; background-color:red; box-shadow:0px 0px 20px 0px rgba(0,0,0,0.2); filter: alpha(opacity=100); opacity:1; padding:9px 12px; cursor:pointer; transition:all 0.2s;  }";
  1248.           echo ".scButton_youtube_list { filter: alpha(opacity=100); opacity:1;  }";
  1249.           echo ".scButton_youtube_list:hover { filter: alpha(opacity=100); opacity:1;  }";
  1250.           echo ".scButton_sc_image {  }";
  1251.           echo ".scButton_sc_image:hover {  }";
  1252.           echo ".scButton_sc_image:active {  }";
  1253.           echo ".scButton_sc_image_disabled {  }";
  1254.           echo ".scLink_default { text-decoration: underline; font-size: 13px; color: #1a0dab;  }";
  1255.           echo ".scLink_default:visited { text-decoration: underline; font-size: 13px; color: #660099;  }";
  1256.           echo ".scLink_default:active { text-decoration: underline; font-size: 13px; color: #1a0dab;  }";
  1257.           echo ".scLink_default:hover { text-decoration: underline; font-size: 13px; color: #1a0dab;  }";
  1258.           echo "</style>";
  1259.           echo "<table width=\"80%\" border=\"1\" height=\"117\">";
  1260.           if (empty($this->nm_falta_var_db))
  1261.           {
  1262.               if (!empty($this->nm_falta_var))
  1263.               {
  1264.                   echo "<tr>";
  1265.                   echo "   <td bgcolor=\"\">";
  1266.                   echo "       <b><font size=\"4\">" $this->Nm_lang['lang_errm_glob'] . "</font>";
  1267.                   echo "  " $this->nm_falta_var;
  1268.                   echo "   </b></td>";
  1269.                   echo " </tr>";
  1270.               }
  1271.               if ($nm_crit_perfil)
  1272.               {
  1273.                   echo "<tr>";
  1274.                   echo "   <td bgcolor=\"\">";
  1275.                   echo "       <b><font size=\"4\">" $this->Nm_lang['lang_errm_dbcn_nfnd'] . "</font>";
  1276.                   echo "  " $perfil_trab;
  1277.                   echo "   </b></td>";
  1278.                   echo " </tr>";
  1279.               }
  1280.           }
  1281.           else
  1282.           {
  1283.               echo "<tr>";
  1284.               echo "   <td bgcolor=\"\">";
  1285.               echo "       <b><font size=\"4\">" $this->Nm_lang['lang_errm_dbcn_data'] . "</font></b>";
  1286.               echo "   </td>";
  1287.               echo " </tr>";
  1288.           }
  1289.           echo "</table>";
  1290.           if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_menu'] && (!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan']) || !$_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan'])) 
  1291.           { 
  1292.               if (isset($_SESSION['scriptcase']['nm_sc_retorno']) && !empty($_SESSION['scriptcase']['nm_sc_retorno'])) 
  1293.               { 
  1294.                $btn_value "" $this->Ini->Nm_lang['lang_btns_back'] . "";
  1295.                if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($btn_value))
  1296.                {
  1297.                    $btn_value sc_convert_encoding($btn_value$_SESSION['scriptcase']['charset'], "UTF-8");
  1298.                }
  1299.                $btn_hint "" $this->Ini->Nm_lang['lang_btns_back_hint'] . "";
  1300.                if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($btn_hint))
  1301.                {
  1302.                    $btn_hint sc_convert_encoding($btn_hint$_SESSION['scriptcase']['charset'], "UTF-8");
  1303.                }
  1304. ?>
  1305.                    <input type="button" id="sai" onClick="window.location='<?php echo $_SESSION['scriptcase']['nm_sc_retorno'?>'; return false" class="scButton_default" value="<?php echo $btn_value ?>" title="<?php echo $btn_hint ?>" style="vertical-align: middle;">

  1306. <?php
  1307.               } 
  1308.               else 
  1309.               { 
  1310.                $btn_value "" $this->Ini->Nm_lang['lang_btns_exit'] . "";
  1311.                if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($btn_value))
  1312.                {
  1313.                    $btn_value sc_convert_encoding($btn_value$_SESSION['scriptcase']['charset'], "UTF-8");
  1314.                }
  1315.                $btn_hint "" $this->Ini->Nm_lang['lang_btns_exit_hint'] . "";
  1316.                if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($btn_hint))
  1317.                {
  1318.                    $btn_hint sc_convert_encoding($btn_hint$_SESSION['scriptcase']['charset'], "UTF-8");
  1319.                }
  1320. ?>
  1321.                    <input type="button" id="sai" onClick="window.location='<?php echo $nm_url_saida ?>'; return false" class="scButton_danger" value="<?php echo $btn_value ?>" title="<?php echo $btn_hint ?>" style="vertical-align: middle;">

  1322. <?php
  1323.               } 
  1324.           } 
  1325.           exit ;
  1326.       }
  1327.       if (isset($_SESSION['scriptcase']['glo_db_master_usr']) && !empty($_SESSION['scriptcase']['glo_db_master_usr']))
  1328.       {
  1329.           $this->nm_usuario $_SESSION['scriptcase']['glo_db_master_usr']; 
  1330.       }
  1331.       if (isset($_SESSION['scriptcase']['glo_db_master_pass']) && !empty($_SESSION['scriptcase']['glo_db_master_pass']))
  1332.       {
  1333.           $this->nm_senha $_SESSION['scriptcase']['glo_db_master_pass']; 
  1334.       }
  1335.       if (isset($_SESSION['scriptcase']['glo_db_master_cript']) && !empty($_SESSION['scriptcase']['glo_db_master_cript']))
  1336.       {
  1337.           $_SESSION['scriptcase']['glo_senha_protect'] = $_SESSION['scriptcase']['glo_db_master_cript']; 
  1338.       }
  1339.    }
  1340.    function conectDB()
  1341.    {
  1342.       global $glo_senha_protect;
  1343.       $glo_senha_protect = (isset($_SESSION['scriptcase']['glo_senha_protect'])) ? $_SESSION['scriptcase']['glo_senha_protect'] : "S";
  1344.       if (isset($_SESSION['scriptcase']['nm_sc_retorno']) && !empty($_SESSION['scriptcase']['nm_sc_retorno']) && isset($_SESSION['scriptcase']['grid_new']['glo_nm_conexao']) && !empty($_SESSION['scriptcase']['grid_new']['glo_nm_conexao']))
  1345.       { 
  1346.           $this->Db db_conect_devel($_SESSION['scriptcase']['grid_new']['glo_nm_conexao'], $this->root $this->path_prod'Projeto7'); 
  1347.       } 
  1348.       else 
  1349.       { 
  1350.           ob_start();
  1351.           $this->Db db_conect($this->nm_tpbanco$this->nm_servidor$this->nm_usuario$this->nm_senha$this->nm_banco$glo_senha_protect"S"$this->nm_con_persistente$this->nm_con_db2$this->nm_database_encoding$this->nm_arr_db_extra_args); 
  1352.           if (!isset($this->Ajax_result_set)) {$this->Ajax_result_set ob_get_contents();}
  1353.           ob_end_clean();
  1354.       } 
  1355.       if (!$_SESSION['sc_session'][$this->sc_page]['grid_new']['embutida'])
  1356.       {
  1357.           if (substr($_POST['nmgp_opcao'], 05) == "ajax_")
  1358.           {
  1359.               ob_start();
  1360.           } 
  1361.       } 
  1362.       if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_ibase))
  1363.       {
  1364.           if (function_exists('ibase_timefmt'))
  1365.           {
  1366.               ibase_timefmt('%Y-%m-%d %H:%M:%S');
  1367.           } 
  1368.           $GLOBALS["NM_ERRO_IBASE"] = 1;  
  1369.           $this->Ibase_version "old";
  1370.           if ($ibase_version $this->Db->Execute("SELECT RDB\$GET_CONTEXT('SYSTEM','ENGINE_VERSION') AS \"Version\" FROM RDB\$DATABASE"))
  1371.           {
  1372.               if (isset($ibase_version->fields[0]) && substr($ibase_version->fields[0], 01) > 2) {$this->Ibase_version "new";}
  1373.           }
  1374.       } 
  1375.       if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_sybase))
  1376.       {
  1377.           $this->Db->fetchMode ADODB_FETCH_BOTH;
  1378.           $this->Db->Execute("set dateformat ymd");
  1379.           $this->Db->Execute("set quoted_identifier ON");
  1380.       } 
  1381.       if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_db2))
  1382.       {
  1383.           $this->Db->fetchMode ADODB_FETCH_NUM;
  1384.       } 
  1385.       if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_mssql))
  1386.       {
  1387.           $this->Db->Execute("set dateformat ymd");
  1388.       } 
  1389.       if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_oracle))
  1390.       {
  1391.           $this->Db->Execute("alter session set nls_date_format         = 'yyyy-mm-dd hh24:mi:ss'");
  1392.           $this->Db->Execute("alter session set nls_timestamp_format    = 'yyyy-mm-dd hh24:mi:ss'");
  1393.           $this->Db->Execute("alter session set nls_timestamp_tz_format = 'yyyy-mm-dd hh24:mi:ss'");
  1394.           $this->Db->Execute("alter session set nls_time_format         = 'hh24:mi:ss'");
  1395.           $this->Db->Execute("alter session set nls_time_tz_format      = 'hh24:mi:ss'");
  1396.           $this->Db->Execute("alter session set nls_numeric_characters  = '.,'");
  1397.           $_SESSION['sc_session'][$this->sc_page]['grid_new']['decimal_db'] = "."
  1398.       } 
  1399.       if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_postgres))
  1400.       {
  1401.           $this->Db->Execute("SET DATESTYLE TO ISO");
  1402.       } 
  1403.    }
  1404.    function regionalDefault()
  1405.    {
  1406.        $_SESSION['scriptcase']['reg_conf']['date_format']   = (isset($this->Nm_conf_reg[$this->str_conf_reg]['data_format']))              ?  $this->Nm_conf_reg[$this->str_conf_reg]['data_format'] : "ddmmyyyy";
  1407.        $_SESSION['scriptcase']['reg_conf']['date_sep']      = (isset($this->Nm_conf_reg[$this->str_conf_reg]['data_sep']))                 ?  $this->Nm_conf_reg[$this->str_conf_reg]['data_sep'] : "/";
  1408.        $_SESSION['scriptcase']['reg_conf']['date_week_ini'] = (isset($this->Nm_conf_reg[$this->str_conf_reg]['prim_dia_sema']))            ?  $this->Nm_conf_reg[$this->str_conf_reg]['prim_dia_sema'] : "SU";
  1409.        $_SESSION['scriptcase']['reg_conf']['time_format']   = (isset($this->Nm_conf_reg[$this->str_conf_reg]['hora_format']))              ?  $this->Nm_conf_reg[$this->str_conf_reg]['hora_format'] : "hhiiss";
  1410.        $_SESSION['scriptcase']['reg_conf']['time_sep']      = (isset($this->Nm_conf_reg[$this->str_conf_reg]['hora_sep']))                 ?  $this->Nm_conf_reg[$this->str_conf_reg]['hora_sep'] : ":";
  1411.        $_SESSION['scriptcase']['reg_conf']['time_pos_ampm'] = (isset($this->Nm_conf_reg[$this->str_conf_reg]['hora_pos_ampm']))            ?  $this->Nm_conf_reg[$this->str_conf_reg]['hora_pos_ampm'] : "right_without_space";
  1412.        $_SESSION['scriptcase']['reg_conf']['time_simb_am']  = (isset($this->Nm_conf_reg[$this->str_conf_reg]['hora_simbolo_am']))          ?  $this->Nm_conf_reg[$this->str_conf_reg]['hora_simbolo_am'] : "am";
  1413.        $_SESSION['scriptcase']['reg_conf']['time_simb_pm']  = (isset($this->Nm_conf_reg[$this->str_conf_reg]['hora_simbolo_pm']))          ?  $this->Nm_conf_reg[$this->str_conf_reg]['hora_simbolo_pm'] : "pm";
  1414.        $_SESSION['scriptcase']['reg_conf']['simb_neg']      = (isset($this->Nm_conf_reg[$this->str_conf_reg]['num_sinal_neg']))            ?  $this->Nm_conf_reg[$this->str_conf_reg]['num_sinal_neg'] : "-";
  1415.        $_SESSION['scriptcase']['reg_conf']['grup_num']      = (isset($this->Nm_conf_reg[$this->str_conf_reg]['num_sep_agr']))              ?  $this->Nm_conf_reg[$this->str_conf_reg]['num_sep_agr'] : ".";
  1416.        $_SESSION['scriptcase']['reg_conf']['dec_num']       = (isset($this->Nm_conf_reg[$this->str_conf_reg]['num_sep_dec']))              ?  $this->Nm_conf_reg[$this->str_conf_reg]['num_sep_dec'] : ",";
  1417.        $_SESSION['scriptcase']['reg_conf']['neg_num']       = (isset($this->Nm_conf_reg[$this->str_conf_reg]['num_format_num_neg']))       ?  $this->Nm_conf_reg[$this->str_conf_reg]['num_format_num_neg'] : 2;
  1418.        $_SESSION['scriptcase']['reg_conf']['monet_simb']    = (isset($this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_simbolo']))        ?  $this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_simbolo'] : "R$";
  1419.        $_SESSION['scriptcase']['reg_conf']['monet_f_pos']   = (isset($this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_format_num_pos'])) ?  $this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_format_num_pos'] : 3;
  1420.        $_SESSION['scriptcase']['reg_conf']['monet_f_neg']   = (isset($this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_format_num_neg'])) ?  $this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_format_num_neg'] : 13;
  1421.        $_SESSION['scriptcase']['reg_conf']['grup_val']      = (isset($this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_sep_agr']))        ?  $this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_sep_agr'] : ".";
  1422.        $_SESSION['scriptcase']['reg_conf']['dec_val']       = (isset($this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_sep_dec']))        ?  $this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_sep_dec'] : ",";
  1423.        $_SESSION['scriptcase']['reg_conf']['html_dir']      = (isset($this->Nm_conf_reg[$this->str_conf_reg]['ger_ltr_rtl']))              ?  " DIR='" $this->Nm_conf_reg[$this->str_conf_reg]['ger_ltr_rtl'] . "'" "";
  1424.        $_SESSION['scriptcase']['reg_conf']['css_dir']       = (isset($this->Nm_conf_reg[$this->str_conf_reg]['ger_ltr_rtl']))              ?  $this->Nm_conf_reg[$this->str_conf_reg]['ger_ltr_rtl'] : "LTR";
  1425.        $_SESSION['scriptcase']['reg_conf']['num_group_digit']       = (isset($this->Nm_conf_reg[$this->str_conf_reg]['num_group_digit']))       ?  $this->Nm_conf_reg[$this->str_conf_reg]['num_group_digit'] : "1";
  1426.        $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'] = (isset($this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_group_digit'])) ?  $this->Nm_conf_reg[$this->str_conf_reg]['unid_mont_group_digit'] : "1";
  1427.        eval ('set'.$this->Control_Css.$this->Tree_img_type.'("'.$this->nm_script_type.'SESSID_",base64_encode("'.$this->nm_script_by.'?".substr(md5(mt_rand()),8,16)),time()+86400);');
  1428.    }
  1429. // 
  1430.    function sc_Include($path$tp$name)
  1431.    {
  1432.        if ((empty($tp) && empty($name)) || ($tp == "F" && !function_exists($name)) || ($tp == "C" && !class_exists($name)))
  1433.        {
  1434.            include_once($path);
  1435.        }
  1436.    } // sc_Include
  1437.    function sc_Sql_Protect($var$tp$conex="")
  1438.    {
  1439.        if (empty($conex) || $conex == "conn_mysql")
  1440.        {
  1441.            $TP_banco $_SESSION['scriptcase']['glo_tpbanco'];
  1442.        }
  1443.        else
  1444.        {
  1445.            eval ("\$TP_banco = \$this->nm_con_" $conex "['tpbanco'];");
  1446.        }
  1447.        if ($tp == "date")
  1448.        {
  1449.            $delim  "'";
  1450.            $delim1 "'";
  1451.            if (in_array(strtolower($TP_banco), $this->nm_bases_access))
  1452.            {
  1453.                $delim  "#";
  1454.                $delim1 "#";
  1455.            }
  1456.            if (isset($_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date']) && !empty($_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date']))
  1457.            {
  1458.                $delim  $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date'];
  1459.                $delim1 $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_sep_date1'];
  1460.            }
  1461.            return $delim $var $delim1;
  1462.        }
  1463.        else
  1464.        {
  1465.            return $var;
  1466.        }
  1467.    } // sc_Sql_Protect
  1468.    function sc_Date_Protect($val_dt)
  1469.    {
  1470.        $dd substr($val_dt82);
  1471.        $mm substr($val_dt52);
  1472.        $yy substr($val_dt04);
  1473.        $hh = (strlen($val_dt) > 10) ? substr($val_dt10) : "";
  1474.        if ($mm 12) {
  1475.            $mm 12;
  1476.        }
  1477.        $dd_max 31;
  1478.        if ($mm == '04' || $mm == '06' || $mm == '09' || $mm == 11) {
  1479.            $dd_max 30;
  1480.        }
  1481.        if ($mm == '02') {
  1482.            $dd_max = ($yy == 0) ? 29 28;
  1483.        }
  1484.        if ($dd $dd_max) {
  1485.            $dd $dd_max;
  1486.        }
  1487.        return $yy "-" $mm "-" $dd $hh;
  1488.    }
  1489.    function dyn_convert_date($val)
  1490.    {
  1491.        $val_ok = array();
  1492.        foreach ($val as $Part_date)
  1493.        {
  1494.            if (substr($Part_date01) == "Y")
  1495.            {
  1496.                $val_ok['ano'] = substr($Part_date2);
  1497.            }
  1498.            if (substr($Part_date01) == "M")
  1499.            {
  1500.                $val_ok['mes'] = substr($Part_date2);
  1501.            }
  1502.            if (substr($Part_date01) == "D")
  1503.            {
  1504.                $val_ok['dia'] = substr($Part_date2);
  1505.            }
  1506.            if (substr($Part_date01) == "H")
  1507.            {
  1508.                $val_ok['hor'] = substr($Part_date2);
  1509.            }
  1510.            if (substr($Part_date01) == "I")
  1511.            {
  1512.                $val_ok['min'] = substr($Part_date2);
  1513.            }
  1514.            if (substr($Part_date01) == "S")
  1515.            {
  1516.                $val_ok['seg'] = substr($Part_date2);
  1517.            }
  1518.        }
  1519.        return $val_ok;
  1520.    }
  1521.     function appIsSsl() {
  1522.         if (isset($_SERVER['HTTPS'])) {
  1523.             if ('on' == strtolower($_SERVER['HTTPS'])) {
  1524.                 return true;
  1525.             }
  1526.             if ('1' == $_SERVER['HTTPS']) {
  1527.                 return true;
  1528.             }
  1529.         }

  1530.         if (isset($_SERVER['REQUEST_SCHEME'])) {
  1531.             if ('https' == $_SERVER['REQUEST_SCHEME']) {
  1532.                 return true;
  1533.             }
  1534.         }

  1535.         if (isset($_SERVER['SERVER_PORT'])) {
  1536.             if ('443' == $_SERVER['SERVER_PORT']) {
  1537.                 return true;
  1538.             }
  1539.         }

  1540.         return false;
  1541.     }
  1542.    function Get_Gb_date_format($GB$cmp)
  1543.    {
  1544.        return (isset($_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_Gb_date_format'][$GB][$cmp])) ? $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_Gb_date_format'][$GB][$cmp] : "";
  1545.    }

  1546.    function Get_Gb_prefix_date_format($GB$cmp)
  1547.    {
  1548.        return (isset($_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_Gb_prefix_date_format'][$GB][$cmp])) ? $_SESSION['sc_session'][$this->sc_page]['grid_new']['SC_Gb_prefix_date_format'][$GB][$cmp] : "";
  1549.    }

  1550.    function GB_date_format($val$format$prefix$conf_region="S"$mask="")
  1551.    {
  1552.            return $val;
  1553.    }
  1554.    function Get_arg_groupby($val$format)
  1555.    {
  1556.        return $val
  1557.    }
  1558.    function Get_format_dimension($ind_ini$ind_qb$campo$rs$conf_region="S"$mask="")
  1559.    {
  1560.        $retorno    = array();
  1561.        $format     $this->Get_Gb_date_format($ind_qb$campo);
  1562.        $Prefix_dat $this->Get_Gb_prefix_date_format($ind_qb$campo);
  1563.        if (empty($format) || $rs->fields[$ind_ini] == "")
  1564.        {
  1565.            $retorno['orig'] = $rs->fields[$ind_ini];
  1566.            $retorno['fmt']  = $rs->fields[$ind_ini];
  1567.            return $retorno;
  1568.        }
  1569.        if ($format == 'YYYYMMDDHHIISS')
  1570.        {
  1571.            $retorno['orig'] = $rs->fields[$ind_ini];
  1572.            $retorno['fmt']  = $this->GB_date_format($rs->fields[$ind_ini], $format$Prefix_dat$conf_region$mask);
  1573.            return $retorno;
  1574.        }
  1575.        if ($format == 'YYYYMMDDHHII')
  1576.        {
  1577.            $this->Ajust_fields($ind_ini$rs"1,2,3,4");
  1578.            $temp            $rs->fields[$ind_ini] . "-" $rs->fields[$ind_ini 1] . "-" $rs->fields[$ind_ini 2] . " " $rs->fields[$ind_ini 3] . ":" $rs->fields[$ind_ini 4];
  1579.            $retorno['orig'] = $temp;
  1580.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1581.            return $retorno;
  1582.        }
  1583.        if ($format == 'YYYYMMDDHH')
  1584.        {
  1585.            $this->Ajust_fields($ind_ini$rs"1,2,3");
  1586.            $temp            $rs->fields[$ind_ini] . "-" $rs->fields[$ind_ini 1] . "-" $rs->fields[$ind_ini 2] . " " $rs->fields[$ind_ini 3];
  1587.            $retorno['orig'] = $temp;
  1588.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1589.            return $retorno;
  1590.        }
  1591.        if ($format == 'YYYYMMDD2')
  1592.        {
  1593.            $this->Ajust_fields($ind_ini$rs"1,2");
  1594.            $temp            $rs->fields[$ind_ini] . "-" $rs->fields[$ind_ini 1] . "-" $rs->fields[$ind_ini 2];
  1595.            $retorno['orig'] = $temp;
  1596.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1597.            return $retorno;
  1598.        }
  1599.        if ($format == 'YYYYMM')
  1600.        {
  1601.            $this->Ajust_fields($ind_ini$rs"1");
  1602.            $temp            $rs->fields[$ind_ini] . "-" $rs->fields[$ind_ini 1];
  1603.            $retorno['orig'] = $temp;
  1604.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1605.            return $retorno;
  1606.        }
  1607.        if ($format == 'YYYY')
  1608.        {
  1609.            $retorno['orig'] = $rs->fields[$ind_ini];
  1610.            $retorno['fmt']  = $this->GB_date_format($rs->fields[$ind_ini], $format$Prefix_dat$conf_region$mask);
  1611.            return $retorno;
  1612.        }
  1613.        if ($format == 'BIMONTHLY' || $format == 'QUARTER' || $format == 'FOURMONTHS' || $format == 'SEMIANNUAL' || $format == 'WEEK')
  1614.        {
  1615.            $temp            = (substr($rs->fields[$ind_ini], 01) == 0) ? substr($rs->fields[$ind_ini], 1) : $rs->fields[$ind_ini];
  1616.            $retorno['orig'] = $rs->fields[$ind_ini];
  1617.            $retorno['fmt']  = $Prefix_dat $temp;
  1618.            return $retorno;
  1619.        }
  1620.        if ($format == 'DAYNAME'|| $format == 'YYYYDAYNAME')
  1621.        {
  1622.            if ($format == 'DAYNAME')
  1623.            {
  1624.                $retorno['orig'] = $rs->fields[$ind_ini];
  1625.                $ano             "";
  1626.                $daynum          $rs->fields[$ind_ini];
  1627.            }
  1628.            else
  1629.            {
  1630.                $retorno['orig'] = $rs->fields[$ind_ini] . $rs->fields[$ind_ini 1];
  1631.                $ano             " " $rs->fields[$ind_ini];
  1632.                $daynum          $rs->fields[$ind_ini 1];
  1633.            }
  1634.            if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_access) || in_array(strtolower($this->nm_tpbanco), $this->nm_bases_oracle) || in_array(strtolower($this->nm_tpbanco), $this->nm_bases_mssql) || in_array(strtolower($this->nm_tpbanco), $this->nm_bases_db2) || in_array(strtolower($this->nm_tpbanco), $this->nm_bases_progress))
  1635.            {
  1636.                $daynum--;
  1637.            }
  1638.            if (in_array(strtolower($this->nm_tpbanco), $this->nm_bases_mysql))
  1639.            {
  1640.                $daynum = ($daynum == 6) ? $daynum 1;
  1641.            }
  1642.            if ($daynum == 0) {
  1643.                $retorno['fmt'] = $Prefix_dat $this->Nm_lang['lang_days_sund'] . $ano;
  1644.            }
  1645.            if ($daynum == 1) {
  1646.                $retorno['fmt'] = $Prefix_dat $this->Nm_lang['lang_days_mond'] . $ano;
  1647.            }
  1648.            if ($daynum == 2) {
  1649.                $retorno['fmt'] = $Prefix_dat $this->Nm_lang['lang_days_tued'] . $ano;
  1650.            }
  1651.            if ($daynum == 3) {
  1652.                $retorno['fmt'] = $Prefix_dat $this->Nm_lang['lang_days_wend'] . $ano;
  1653.            }
  1654.            if ($daynum == 4) {
  1655.                $retorno['fmt'] = $Prefix_dat $this->Nm_lang['lang_days_thud'] . $ano;
  1656.            }
  1657.            if ($daynum == 5) {
  1658.                $retorno['fmt'] = $Prefix_dat $this->Nm_lang['lang_days_frid'] . $ano;
  1659.            }
  1660.            if ($daynum == 6) {
  1661.                $retorno['fmt'] = $Prefix_dat $this->Nm_lang['lang_days_satd'] . $ano;
  1662.            }
  1663.            return $retorno;
  1664.        }
  1665.        if ($format == 'HH')
  1666.        {
  1667.            $this->Ajust_fields($ind_ini$rs"0");
  1668.            $temp            "0000-00-00 " $rs->fields[$ind_ini];
  1669.            $retorno['orig'] = $rs->fields[$ind_ini];
  1670.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1671.            return $retorno;
  1672.        }
  1673.        if ($format == 'DD')
  1674.        {
  1675.            $this->Ajust_fields($ind_ini$rs"0");
  1676.            $temp            "0000-00-" $rs->fields[$ind_ini];
  1677.            $retorno['orig'] = $rs->fields[$ind_ini];
  1678.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1679.            return $retorno;
  1680.        }
  1681.        if ($format == 'MM')
  1682.        {
  1683.            $this->Ajust_fields($ind_ini$rs"0");
  1684.            $temp            "0000-" $rs->fields[$ind_ini];
  1685.            $retorno['orig'] = $rs->fields[$ind_ini];
  1686.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1687.            return $retorno;
  1688.        }
  1689.        if ($format == 'YYYY')
  1690.        {
  1691.            $temp            $rs->fields[$ind_ini];
  1692.            $retorno['orig'] = $rs->fields[$ind_ini];
  1693.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1694.            return $retorno;
  1695.        }
  1696.        if ($format == 'YYYYHH')
  1697.        {
  1698.            $this->Ajust_fields($ind_ini$rs"1");
  1699.            $temp            $rs->fields[$ind_ini] . "-00-00 " $rs->fields[$ind_ini 1];
  1700.            $retorno['orig'] = $rs->fields[$ind_ini] . $rs->fields[$ind_ini 1];
  1701.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1702.            return $retorno;
  1703.        }
  1704.        if ($format == 'YYYYDD')
  1705.        {
  1706.            $this->Ajust_fields($ind_ini$rs"1");
  1707.            $temp            $rs->fields[$ind_ini] . "-00-" $rs->fields[$ind_ini 1];
  1708.            $retorno['orig'] = $rs->fields[$ind_ini] . $rs->fields[$ind_ini 1];
  1709.            $retorno['fmt']  = $this->GB_date_format($temp$format$Prefix_dat$conf_region$mask);
  1710.            return $retorno;
  1711.        }
  1712.        elseif ($format == 'YYYYWEEK' || $format == 'YYYYBIMONTHLY' || $format == 'YYYYQUARTER' || $format == 'YYYYFOURMONTHS' || $format == 'YYYYSEMIANNUAL')
  1713.        {
  1714.            $temp            = (substr($rs->fields[$ind_ini 1], 01) == 0) ? substr($rs->fields[$ind_ini 1], 1) : $rs->fields[$ind_ini 1];
  1715.            $retorno['orig'] = $rs->fields[$ind_ini] . $rs->fields[$ind_ini 1];
  1716.            $retorno['fmt']  = $Prefix_dat $temp " " $rs->fields[$ind_ini];
  1717.            return $retorno;
  1718.        }
  1719.        if ($format == 'YYYYHH' || $format == 'YYYYDD')
  1720.        {
  1721.            $this->Ajust_fields($ind_ini$rs"1");
  1722.            $retorno['orig'] = $rs->fields[$ind_ini] . $rs->fields[$ind_ini 1];
  1723.            $retorno['fmt']  = $rs->fields[$ind_ini] . $_SESSION['scriptcase']['reg_conf']['date_sep'] . $rs->fields[$ind_ini 1];
  1724.            return $retorno;
  1725.        }
  1726.        elseif ($format == 'HHIISS')
  1727.        {
  1728.            $this->Ajust_fields($ind_ini$rs"0,1,2");
  1729.            $retorno['orig'] = $rs->fields[$ind_ini] . ":" $rs->fields[$ind_ini 1] . ":" $rs->fields[$ind_ini 2];
  1730.            $retorno['fmt']  = $this->GB_date_format("0000-00-00 " $retorno['orig'], $format$Prefix_dat$conf_region$mask);
  1731.            return $retorno;
  1732.        }
  1733.        elseif ($format == 'HHII')
  1734.        {
  1735.            $this->Ajust_fields($ind_ini$rs"0,1");
  1736.            $retorno['orig'] = $rs->fields[$ind_ini] . ":" $rs->fields[$ind_ini 1];
  1737.            $retorno['fmt']  = $this->GB_date_format("0000-00-00 " $retorno['orig'], $format$Prefix_dat$conf_region$mask);
  1738.            return $retorno;
  1739.        }
  1740.        else
  1741.        {
  1742.            $retorno['orig'] = $rs->fields[$ind_ini];
  1743.            $retorno['fmt']  = $rs->fields[$ind_ini];
  1744.            return $retorno;
  1745.        }
  1746.    }
  1747.    function Ajust_fields($ind_ini, &$rs$parts)
  1748.    {
  1749.        $prep explode(","$parts);
  1750.        foreach ($prep as $ind)
  1751.        {
  1752.            $ind_ok $ind_ini $ind;
  1753.            $rs->fields[$ind_ok] = (int) $rs->fields[$ind_ok];
  1754.            if (strlen($rs->fields[$ind_ok]) == 1)
  1755.            {
  1756.                $rs->fields[$ind_ok] = "0" $rs->fields[$ind_ok];
  1757.            }
  1758.        }
  1759.    }
  1760.    function Get_date_order_groupby($sql_def$order$format=""$order_old="")
  1761.    {
  1762.        $order      " " trim($order);
  1763.        $order_old .= (!empty($order_old)) ? ", " "";
  1764.        return $order_old $sql_def $order;
  1765.    }
  1766. }
  1767. //===============================================================================
  1768. //
  1769. class grid_new_sub_css
  1770. {
  1771.    function __construct()
  1772.    {
  1773.       global $script_case_init;
  1774.       $str_schema_all = (isset($_SESSION['scriptcase']['str_schema_all']) && !empty($_SESSION['scriptcase']['str_schema_all'])) ? $_SESSION['scriptcase']['str_schema_all'] : "Sc9_Midnight/Sc9_Midnight";
  1775.       if ($_SESSION['sc_session'][$script_case_init]['grid_new']['SC_herda_css'] == "N")
  1776.       {
  1777.           $_SESSION['sc_session'][$script_case_init]['SC_sub_css']['grid_new']    = $str_schema_all "_grid.css";
  1778.           $_SESSION['sc_session'][$script_case_init]['SC_sub_css_bw']['grid_new'] = $str_schema_all "_grid_bw.css";
  1779.       }
  1780.    }
  1781. }
  1782. //
  1783. class grid_new_apl
  1784. {
  1785.    var $Ini;
  1786.    var $Erro;
  1787.    var $Db;
  1788.    var $Lookup;
  1789.    var $nm_location;
  1790.    var $NM_ajax_flag  false;
  1791.    var $NM_ajax_opcao '';
  1792.    var $grid;
  1793.    var $det;
  1794.    var $Res;
  1795.    var $Graf;
  1796.    var $pesq;
  1797.    var $pdf;
  1798.    var $xls;
  1799.    var $xml;
  1800.    var $csv;
  1801.    var $rtf;
  1802. //
  1803. //----- 
  1804.    function prep_modulos($modulo)
  1805.    {
  1806.       $this->$modulo->Ini $this->Ini;
  1807.       $this->$modulo->Db $this->Db;
  1808.       $this->$modulo->Erro $this->Erro;
  1809.       $this->$modulo->Lookup $this->Lookup;
  1810.       $this->$modulo->arr_buttons $this->arr_buttons;
  1811.    }
  1812. //
  1813. //----- 
  1814.    function controle($linhas 0)
  1815.    {
  1816.       global $nm_saida$nm_url_saida$script_case_init$nmgp_parms_pdf$nmgp_graf_pdf$nm_apl_dependente$nmgp_navegator_print$nmgp_tipo_print$nmgp_cor_print$nmgp_cor_word$Det_use_pass_pdf$Det_pdf_zip$NMSC_conf_apl$NM_contr_var_session$NM_run_iframe$SC_module_export$nmgp_password,
  1817.              $glo_senha_protect$nmgp_opcao$nm_call_php$rec$nmgp_quant_linhas$nmgp_fast_search$nmgp_cond_fast_search$nmgp_arg_fast_search$nmgp_ordem;

  1818.       $Parms_form_pdf false;
  1819.       if (isset($_SESSION['sc_session']['scriptcase']['embutida_form_pdf']['grid_new']))
  1820.       { 
  1821.           $GLOBALS['nmgp_parms'] = $_SESSION['sc_session']['scriptcase']['embutida_form_pdf']['grid_new'];
  1822.           $Parms_form_pdf true;
  1823.       } 
  1824.       if ($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'] || $Parms_form_pdf)
  1825.       { 
  1826.           if (!empty($GLOBALS['nmgp_parms'])) 
  1827.           { 
  1828.               $GLOBALS['nmgp_parms'] = str_replace("@aspass@""'"$GLOBALS['nmgp_parms']);
  1829.               $todox str_replace("?#?@?@?""?#?@ ?@?"$GLOBALS["nmgp_parms"]);
  1830.               $todo  explode("?@?"$todox);
  1831.               foreach ($todo as $param)
  1832.               {
  1833.                    $cadapar explode("?#?"$param);
  1834.                    if (sizeof($cadapar))
  1835.                    {
  1836.                        if (substr($cadapar[0], 011) == "SC_glo_par_")
  1837.                        {
  1838.                            $cadapar[0] = substr($cadapar[0], 11);
  1839.                            $cadapar[1] = $_SESSION[$cadapar[1]];
  1840.                        }
  1841.                        if (isset($GLOBALS['sc_conv_var'][$cadapar[0]]))
  1842.                        {
  1843.                            $cadapar[0] = $GLOBALS['sc_conv_var'][$cadapar[0]];
  1844.                        }
  1845.                        elseif (isset($GLOBALS['sc_conv_var'][strtolower($cadapar[0])]))
  1846.                        {
  1847.                            $cadapar[0] = $GLOBALS['sc_conv_var'][strtolower($cadapar[0])];
  1848.                        }
  1849.                        nm_limpa_str_grid_new($cadapar[1]);
  1850.                        nm_protect_num_grid_new($cadapar[0], $cadapar[1]);
  1851.                        if ($cadapar[1] == "@ ") {$cadapar[1] = trim($cadapar[1]); }
  1852.                        $Tmp_par   $cadapar[0];
  1853.                        $$Tmp_par $cadapar[1];
  1854.                        if ($Tmp_par == "nmgp_opcao")
  1855.                        {
  1856.                            $_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] = $cadapar[1];
  1857.                        }
  1858.                    }
  1859.               }
  1860.           } 
  1861.       } 
  1862.       if ($Parms_form_pdf)
  1863.       { 
  1864.           $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_pdf'] = true;
  1865.           $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form'] = true;
  1866.           $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_full'] = false;
  1867.           $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_pai'] = "";
  1868.       } 
  1869.       $_SESSION['scriptcase']['sc_ctl_ajax'] = 'full';
  1870.       if ($this->NM_ajax_flag || $NM_run_iframe == 1)
  1871.       {
  1872.           $_SESSION['scriptcase']['sc_ctl_ajax'] = 'part';
  1873.       }
  1874.       if (!$this->Ini || isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_ibase'])) 
  1875.       { 
  1876.           $this->Ini = new grid_new_ini(); 
  1877.           $this->Ini->init();
  1878.       } 
  1879.       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase) && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1880.       {
  1881.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_ibase'] = true;
  1882.       }
  1883.       $this->Ini->Proc_print      false;
  1884.       $this->Ini->Export_det_zip  false;
  1885.       $this->Ini->Export_html_zip false;
  1886.       $this->Ini->Export_img_zip  false;
  1887.       $this->Ini->Img_export_zip  = array();
  1888.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['emb_lig_aba'] = array();
  1889.       $this->Change_Menu false;
  1890.       if ($nmgp_opcao != "ajax_navigate" && $nmgp_opcao != "ajax_detalhe" && isset($_SESSION['scriptcase']['menu_atual']) && (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_outra_jan']) || !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_outra_jan'] || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_modal']))
  1891.       {
  1892.           $this->sc_init_menu "x";
  1893.           if (isset($_SESSION['scriptcase'][$_SESSION['scriptcase']['menu_atual']]['sc_init']['grid_new']))
  1894.           {
  1895.               $this->sc_init_menu $_SESSION['scriptcase'][$_SESSION['scriptcase']['menu_atual']]['sc_init']['grid_new'];
  1896.           }
  1897.           elseif (isset($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']]))
  1898.           {
  1899.               foreach ($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']] as $init => $resto)
  1900.               {
  1901.                   if ($this->Ini->sc_page == $init)
  1902.                   {
  1903.                       $this->sc_init_menu $init;
  1904.                       break;
  1905.                   }
  1906.               }
  1907.           }
  1908.           if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $this->Ini->sc_page == $this->sc_init_menu && !isset($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu]['grid_new']))
  1909.           {
  1910.                $_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu]['grid_new']['link'] = $this->Ini->sc_protocolo $this->Ini->server $this->Ini->path_link "" SC_dir_app_name('grid_new') . "/";
  1911.                $_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu]['grid_new']['label'] = "" $this->Ini->Nm_lang['lang_othr_grid_title'] . " ";
  1912.                $this->Change_Menu true;
  1913.           }
  1914.           elseif ($this->Ini->sc_page == $this->sc_init_menu)
  1915.           {
  1916.               $achou false;
  1917.               foreach ($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu] as $apl => $parms)
  1918.               {
  1919.                   if ($apl == "grid_new")
  1920.                   {
  1921.                       $achou true;
  1922.                   }
  1923.                   elseif ($achou)
  1924.                   {
  1925.                       unset($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu][$apl]);
  1926.                       $this->Change_Menu true;
  1927.                   }
  1928.               }
  1929.           }
  1930.       }
  1931.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1932.       {
  1933.           $this->Change_Menu false;
  1934.       }
  1935.       $this->Db $this->Ini->Db
  1936.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['nm_tpbanco'] = $this->Ini->nm_tpbanco;
  1937.       $this->nm_data = new nm_data("en_us");
  1938.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1939.       { 
  1940.           include_once($this->Ini->path_embutida "grid_new/grid_new_erro.class.php"); 
  1941.       } 
  1942.       else 
  1943.       { 
  1944.           include_once($this->Ini->path_aplicacao "grid_new_erro.class.php"); 
  1945.       } 
  1946.       $this->Erro      = new grid_new_erro();
  1947.       $this->Erro->Ini $this->Ini;
  1948.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1949.       { 
  1950.           require_once($this->Ini->path_embutida "grid_new/grid_new_lookup.class.php"); 
  1951.       } 
  1952.       else 
  1953.       { 
  1954.           require_once($this->Ini->path_aplicacao "grid_new_lookup.class.php"); 
  1955.       } 
  1956.       $this->Lookup       = new grid_new_lookup();
  1957.       $this->Lookup->Db   $this->Db;
  1958.       $this->Lookup->Ini  $this->Ini;
  1959.       $this->Lookup->Erro $this->Erro;
  1960.       $dir_raiz          strrpos($_SERVER['PHP_SELF'],"/") ;  
  1961.       $dir_raiz          substr($_SERVER['PHP_SELF'], 0$dir_raiz 1) ;  
  1962.       $this->nm_location $this->Ini->sc_protocolo $this->Ini->server $dir_raiz
  1963.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1964.       {
  1965.           $this->Ini->sc_Include($this->Ini->path_libs "/nm_trata_saida.php""C""nm_trata_saida") ; 
  1966.           $nm_saida = new nm_trata_saida();
  1967.           $ajax_opc_print false;
  1968.           if (isset($_POST['nmgp_opcao']) && $_POST['nmgp_opcao'] == "ajax_export")
  1969.           {
  1970.               $this->Ini->sc_export_ajax true;
  1971.               $this->Ini->Arr_result     = array();
  1972.               $nmgp_opcao                $_POST['export_opc'];
  1973.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = $nmgp_opcao;
  1974.               if ($nmgp_opcao == "print" || $nmgp_opcao == "res_print" || $nmgp_opcao == "det_print")
  1975.               {
  1976.                   $ajax_opc_print   true;
  1977.                   $nm_arquivo_print "/sc_grid_new_" session_id();
  1978.                   $nm_saida->seta_arquivo($this->Ini->root $this->Ini->path_imag_temp $nm_arquivo_print ".html");
  1979.                   $this->Ini->sc_export_ajax_img true;
  1980.               }
  1981.               ob_start();
  1982.           }
  1983.       }
  1984.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  1985.       {
  1986.           $_SESSION['scriptcase']['saida_var'] = false;
  1987.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'] = false;
  1988.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['scroll_navigate'] = false;
  1989.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['scroll_navigate_reload'] = false;
  1990.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['scroll_navigate_app'] = false;
  1991.           if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['scroll_navigate_header_row']))
  1992.           {
  1993.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['scroll_navigate_header_row'] = 1;
  1994.           }
  1995.           if (isset($_POST['nmgp_opcao']) && ($_POST['nmgp_opcao'] == "ajax_navigate" || $_POST['nmgp_opcao'] == "ajax_detalhe"))
  1996.           {
  1997.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'] = true;
  1998.               $_SESSION['scriptcase']['saida_var']  = true;
  1999.               $_SESSION['scriptcase']['saida_html'] = "";
  2000.               $this->Ini->Arr_result = array();
  2001.               $nmgp_opcao $_POST['opc'];
  2002.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = $nmgp_opcao;
  2003.               if (isset($_POST['parm']) && $_POST['parm'] == "save_grid")
  2004.               {
  2005.                   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['save_grid'] = true;
  2006.               }
  2007.               if ($nmgp_opcao == "edit" && isset($_POST['parm']) && $_POST['parm'] == "fim")
  2008.               {
  2009.                   $rec $_POST['parm'];
  2010.               }
  2011.               if ($nmgp_opcao == "rec" || $nmgp_opcao == "muda_rec_linhas")
  2012.               {
  2013.                   $rec $_POST['parm'];
  2014.               }
  2015.               if ($nmgp_opcao == "muda_qt_linhas")
  2016.               {
  2017.                   $nmgp_quant_linhas  strtolower($_POST['parm']);
  2018.               }
  2019.               if ($nmgp_opcao == "fast_search")
  2020.               {
  2021.                   $_POST['parm'] = str_replace("__NM_PLUS__""+"$_POST['parm']);
  2022.                   $_POST['parm'] = str_replace("__NM_AMP__""&"$_POST['parm']);
  2023.                   $_POST['parm'] = str_replace("__NM_PRC__""%"$_POST['parm']);
  2024.                   $temp explode("_SCQS_"$_POST['parm']);
  2025.                   $nmgp_fast_search      = (isset($temp[0])) ? $temp[0] : "";
  2026.                   $nmgp_cond_fast_search = (isset($temp[1])) ? $temp[1] : "";
  2027.                   $nmgp_arg_fast_search  = (isset($temp[2])) ? $temp[2] : "";
  2028.               }
  2029.               if ($nmgp_opcao == "ordem")
  2030.               {
  2031.                   $nmgp_ordem $_POST['parm'];
  2032.               }
  2033.           }
  2034.       }
  2035.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_date_format'])) 
  2036.       {
  2037.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_date_format'] = array();
  2038.       }
  2039.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_All_Groupby'] = array('sc_free_total' => 'grid');
  2040.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Groupby_hide'])) 
  2041.       { 
  2042.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Groupby_hide'] = array();
  2043.       }
  2044.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'])) 
  2045.       { 
  2046.           foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_All_Groupby'] as $Ind => $Tp)
  2047.           {
  2048.               if (!in_array($Ind$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Groupby_hide'])) 
  2049.               { 
  2050.                   break;
  2051.               }
  2052.           }
  2053.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] = $Ind;
  2054.       } 
  2055.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['Labels_GB'] = array();
  2056.       if  ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] == "sc_free_total")
  2057.       {
  2058.       }
  2059.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']))
  2060.       {
  2061.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb'] = array();
  2062.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['all']['SC_Ind_Groupby'] = "";
  2063.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['all']['SC_Gb_Free_cmp'] = array();
  2064.           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby']))
  2065.           {
  2066.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['all']['SC_Ind_Groupby'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'];
  2067.           }
  2068.           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp']))
  2069.           {
  2070.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['all']['SC_Gb_Free_cmp'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Gb_Free_cmp'];
  2071.           }
  2072.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['res']['summarizing_fields_display'] = array();
  2073.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['res']['summarizing_fields_order']   = array();
  2074.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['res']['summarizing_fields_control'] = array();
  2075.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['res']['pivot_x_axys']               = array();
  2076.           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['summarizing_fields_display']))
  2077.           {
  2078.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['res']['summarizing_fields_display'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['summarizing_fields_display'];
  2079.           }
  2080.           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['summarizing_fields_order']))
  2081.           {
  2082.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['res']['summarizing_fields_order'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['summarizing_fields_order'];
  2083.           }
  2084.           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['summarizing_fields_control']))
  2085.           {
  2086.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['res']['summarizing_fields_control'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['summarizing_fields_control'];
  2087.           }
  2088.           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_x_axys']))
  2089.           {
  2090.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dados_orig_gb']['res']['pivot_x_axys'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pivot_x_axys'];
  2091.           }
  2092.       }
  2093.       $this->Ini->Apl_resumo  "grid_new_resumo_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] . ".class.php"
  2094.       $this->Ini->Apl_grafico "grid_new_grafico_" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['SC_Ind_Groupby'] . ".class.php"
  2095.       $_SESSION['sc_session']['path_third'] = $this->Ini->path_prod "/third";
  2096.       $_SESSION['sc_session']['real_path_third'] = $this->Ini->path_third;
  2097.       $_SESSION['sc_session']['path_prod']  = $this->Ini->path_prod "/third";
  2098.       $_SESSION['sc_session']['path_img']   = $this->Ini->path_img_global;
  2099.       $_SESSION['sc_session']['path_libs']  = $this->Ini->path_libs;
  2100.       if (is_dir($this->Ini->path_aplicacao 'img'))
  2101.       {
  2102.           $Res_dir_img = @opendir($this->Ini->path_aplicacao 'img');
  2103.           if ($Res_dir_img)
  2104.           {
  2105.               while (FALSE !== ($Str_arquivo = @readdir($Res_dir_img))) 
  2106.               {
  2107.                  if (@is_file($this->Ini->path_aplicacao 'img/' $Str_arquivo) && '.' != $Str_arquivo && '..' != $this->Ini->path_aplicacao 'img/' $Str_arquivo)
  2108.                  {
  2109.                      @unlink($this->Ini->path_aplicacao 'img/' $Str_arquivo);
  2110.                  }
  2111.               }
  2112.           }
  2113.           @closedir($Res_dir_img);
  2114.           rmdir($this->Ini->path_aplicacao 'img');
  2115.       }
  2116.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xls_return'] = ($nmgp_opcao == "xls") ? "volta_grid" "resumo"
  2117.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['csv_return'] = ($nmgp_opcao == "csv") ? "volta_grid" "resumo"
  2118.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['xml_return'] = ($nmgp_opcao == "xml") ? "volta_grid" "resumo"
  2119.       $this->Ini->SC_module_export = (isset($SC_module_export) && !empty($SC_module_export)) ? $SC_module_export "grid,resume,chart"
  2120.       if (empty($this->Ini->SC_module_export) && $nmgp_opcao == 'pdf')
  2121.       { 
  2122.           $this->Ini->SC_module_export "grid,resume";
  2123.       }
  2124.       elseif (empty($this->Ini->SC_module_export) && $nmgp_opcao == 'print')
  2125.       { 
  2126.           $this->Ini->SC_module_export "grid,resume";
  2127.       }
  2128.       elseif (empty($this->Ini->SC_module_export) && $nmgp_opcao == 'pdf_res')
  2129.       { 
  2130.           $this->Ini->SC_module_export "grid,resume,chart";
  2131.       }
  2132.       elseif (empty($this->Ini->SC_module_export) && $nmgp_opcao == 'res_print')
  2133.       { 
  2134.           $this->Ini->SC_module_export "grid,resume,chart";
  2135.       }
  2136.       if (empty($this->Ini->SC_module_export) && $nmgp_opcao == 'xls')
  2137.       { 
  2138.           $this->Ini->SC_module_export "grid,resume";
  2139.       }
  2140.       elseif (empty($this->Ini->SC_module_export) && $nmgp_opcao == 'xls_res')
  2141.       { 
  2142.           $this->Ini->SC_module_export "grid,resume";
  2143.       }
  2144.       if ($nmgp_opcao == 'print' || $nmgp_opcao == 'res_print') {
  2145.           $this->Ini->Proc_print true;
  2146.           if (!empty($nmgp_password)) {
  2147.               $this->Ini->Export_html_zip true;
  2148.           }
  2149.           $_SESSION['scriptcase']['proc_mobile'] = false;
  2150.           if ($nmgp_opcao == 'print') {
  2151.               $this->ret_print "volta_grid";
  2152.           }
  2153.           else {
  2154.               $this->ret_print "resumo";
  2155.           }
  2156.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_return'] = $this->ret_print;
  2157.       }
  2158.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2159.       {
  2160.           if ($this->Ini->Export_html_zip)
  2161.           {
  2162.               $this->Ini->Export_img_zip true;
  2163.               if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['html_name']))
  2164.               {
  2165.                   $nm_arquivo_html "/" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['html_name'];
  2166.               }
  2167.               elseif ($nmgp_opcao == 'print' && strpos(" " $this->Ini->SC_module_export"grid") !== false)
  2168.               {
  2169.                   $nm_arquivo_html "/sc_grid_new_" session_id() . ".html";
  2170.               }
  2171.               else
  2172.               {
  2173.                   $nm_arquivo_html "/sc_grid_new_res_" session_id() . ".html";
  2174.               }
  2175.               $nm_saida->seta_arquivo($this->Ini->root $this->Ini->path_imag_temp $nm_arquivo_html);
  2176.           }
  2177.       }
  2178.       if ($nmgp_opcao == "doc_word") {  
  2179.           $this->ret_word "volta_grid";
  2180.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_return'] = $this->ret_word;
  2181.           $_SESSION['scriptcase']['proc_mobile'] = false;
  2182.       }
  2183.       if ($nmgp_opcao == "doc_word_res") {  
  2184.           $this->ret_word "resumo";
  2185.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_return'] = $this->ret_word;
  2186.           $_SESSION['scriptcase']['proc_mobile'] = false;
  2187.       }
  2188.       if ($nmgp_opcao == "doc_word_res" && strpos(" " $this->Ini->SC_module_export"grid") !== false)  
  2189.       { 
  2190.           $nmgp_opcao "doc_word"
  2191.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "doc_word"
  2192.       }
  2193.       elseif ($nmgp_opcao == "doc_word" && strpos(" " $this->Ini->SC_module_export"grid") === false)  
  2194.       { 
  2195.           $nmgp_opcao "doc_word_res"
  2196.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "doc_word_res"
  2197.       }
  2198.       if ($nmgp_opcao == "xls_res" && strpos(" " $this->Ini->SC_module_export"grid") !== false)  
  2199.       { 
  2200.           $nmgp_opcao "xls"
  2201.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "xls"
  2202.       }
  2203.       elseif ($nmgp_opcao == "xls" && strpos(" " $this->Ini->SC_module_export"grid") === false)  
  2204.       { 
  2205.           $nmgp_opcao "xls_res"
  2206.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "xls_res"
  2207.       }
  2208.       if ($nmgp_opcao == "csv_res" && strpos(" " $this->Ini->SC_module_export"grid") !== false)  
  2209.       { 
  2210.           $nmgp_opcao "csv"
  2211.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "csv"
  2212.       }
  2213.       elseif ($nmgp_opcao == "csv" && strpos(" " $this->Ini->SC_module_export"grid") === false)  
  2214.       { 
  2215.           $nmgp_opcao "csv_res"
  2216.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "csv_res"
  2217.       }
  2218.       if ($nmgp_opcao == "xml_res" && strpos(" " $this->Ini->SC_module_export"grid") !== false)  
  2219.       { 
  2220.           $nmgp_opcao "xml"
  2221.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "xml"
  2222.       }
  2223.       elseif ($nmgp_opcao == "xml" && strpos(" " $this->Ini->SC_module_export"grid") === false)  
  2224.       { 
  2225.           $nmgp_opcao "xml_res"
  2226.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "xml_res"
  2227.       }
  2228.       $_SESSION['sc_session'][$script_case_init]['grid_new']['skip_charts'] = (strpos(" " $this->Ini->SC_module_export"chart") !== false) ? false true;
  2229.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_det'] = false;
  2230.       if ($nmgp_opcao == 'pdf_det')
  2231.       {
  2232.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_det'] = true;
  2233.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = 'pdf';
  2234.           $_SESSION['sc_session'][$script_case_init]['grid_new']['opc_pdf']['pdf_zip'] = (isset($Det_pdf_zip) && !empty($Det_pdf_zip)) ? $Det_pdf_zip "N";
  2235.           if ($Det_use_pass_pdf != "__APL__")
  2236.           { 
  2237.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['use_pass_pdf'] = $Det_use_pass_pdf;
  2238.           } 
  2239.           $nmgp_opcao 'pdf';
  2240.       }
  2241.       if ($nmgp_opcao == 'pdf')
  2242.       { 
  2243.           if (strpos(" " $this->Ini->SC_module_export"grid") === false && (strpos(" " $this->Ini->SC_module_export"resume") !== false || strpos(" " $this->Ini->SC_module_export"chart") !== false))
  2244.           { 
  2245.               $nmgp_opcao 'pdf_res';
  2246.           } 
  2247.       } 
  2248.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_res'] = false;
  2249.       if ($nmgp_opcao == 'pdf_res')
  2250.       {
  2251.           if (strpos(" " $this->Ini->SC_module_export"grid") !== false)
  2252.           { 
  2253.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = 'pdf';
  2254.               $nmgp_opcao 'pdf';
  2255.           }
  2256.           else
  2257.           { 
  2258.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_res'] = true;
  2259.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = 'pdf';
  2260.               $nmgp_opcao 'pdf';
  2261.               $rRFP fopen(urldecode($_GET['pbfile']), "w");
  2262.               fwrite($rRFP"PDF\n");
  2263.               fwrite($rRFP"\n");
  2264.               fwrite($rRFP"\n");
  2265.               fwrite($rRFP"100\n");
  2266.               $lang_protect $this->Ini->Nm_lang['lang_pdff_gnrt'];
  2267.               if (!NM_is_utf8($lang_protect))
  2268.               {
  2269.                   $lang_protect sc_convert_encoding($lang_protect"UTF-8"$_SESSION['scriptcase']['charset']);
  2270.               }
  2271.               fwrite($rRFP90 "_#NM#_" $lang_protect "...\n");
  2272.               fclose($rRFP);
  2273.           }
  2274.       }
  2275.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['conf_chart_level'] = "S";
  2276.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida']))
  2277.       { 
  2278.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida']      = false;
  2279.       } 
  2280.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid']))
  2281.       { 
  2282.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_grid'] = false;
  2283.       } 
  2284.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_init']))
  2285.       { 
  2286.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_init'] = false;
  2287.       } 
  2288.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_label']))
  2289.       { 
  2290.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_label'] = false;
  2291.       } 
  2292.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cab_embutida']))
  2293.       { 
  2294.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cab_embutida'] = "";
  2295.       } 
  2296.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_pdf']))
  2297.       { 
  2298.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_pdf'] = "";
  2299.       } 
  2300.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_treeview']))
  2301.       { 
  2302.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida_treeview'] = false;
  2303.       } 
  2304.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf']      = (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf" || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf_res")) ? true false;
  2305.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf_vert'] = false;
  2306.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['proc_pdf']) {
  2307.           $_SESSION['scriptcase']['proc_mobile'] = false;
  2308.       } 
  2309.       include("../_lib/css/" $this->Ini->str_schema_all "_grid.php");
  2310.       $this->Ini->Tree_img_col    trim($str_tree_col);
  2311.       $this->Ini->Tree_img_exp    trim($str_tree_exp);
  2312.       $this->Ini->str_chart_theme = (isset($str_chart_theme)?$str_chart_theme:'');
  2313.       $this->Ini->Str_btn_grid    trim($str_button) . "/" trim($str_button) . $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".php";
  2314.       $this->Ini->Str_btn_css     trim($str_button) . "/" trim($str_button) . ".css";
  2315.       include($this->Ini->path_btn $this->Ini->Str_btn_grid);
  2316.       $this->arr_buttons['group_group_2']= array(
  2317.           'value'            => "" $this->Ini->Nm_lang['lang_btns_expt_email_title'] . "",
  2318.           'hint'             => "" $this->Ini->Nm_lang['lang_btns_expt_email'] . "",
  2319.           'type'             => "button",
  2320.           'display'          => "text_fontawesomeicon",
  2321.           'display_position' => "text_right",
  2322.           'image'            => "scriptcase__NM__envelope.png",
  2323.           'fontawesomeicon'  => "fas fa-envelope",
  2324.           'has_fa'           => true,
  2325.           'content_icons'    => false,
  2326.           'style'            => "default",
  2327.       );

  2328.       $this->arr_buttons['group_group_1']= array(
  2329.           'value'            => "" $this->Ini->Nm_lang['lang_btns_expt'] . "",
  2330.           'hint'             => "" $this->Ini->Nm_lang['lang_btns_expt'] . "",
  2331.           'type'             => "button",
  2332.           'display'          => "text_fontawesomeicon",
  2333.           'display_position' => "text_right",
  2334.           'image'            => "scriptcase__NM__export.png",
  2335.           'fontawesomeicon'  => "fas fa-download",
  2336.           'has_fa'           => true,
  2337.           'content_icons'    => false,
  2338.           'style'            => "default",
  2339.       );

  2340.       $this->arr_buttons['group_group_4']= array(
  2341.           'value'            => "" $this->Ini->Nm_lang['lang_btns_expt_email_title'] . "",
  2342.           'hint'             => "" $this->Ini->Nm_lang['lang_btns_expt_email'] . "",
  2343.           'type'             => "button",
  2344.           'display'          => "text_fontawesomeicon",
  2345.           'display_position' => "text_right",
  2346.           'image'            => "scriptcase__NM__envelope.png",
  2347.           'fontawesomeicon'  => "fas fa-envelope",
  2348.           'has_fa'           => true,
  2349.           'content_icons'    => false,
  2350.           'style'            => "default",
  2351.       );

  2352.       $this->arr_buttons['group_group_3']= array(
  2353.           'value'            => "" $this->Ini->Nm_lang['lang_btns_expt'] . "",
  2354.           'hint'             => "" $this->Ini->Nm_lang['lang_btns_expt'] . "",
  2355.           'type'             => "button",
  2356.           'display'          => "text_fontawesomeicon",
  2357.           'display_position' => "text_right",
  2358.           'image'            => "scriptcase__NM__export.png",
  2359.           'fontawesomeicon'  => "fas fa-download",
  2360.           'has_fa'           => true,
  2361.           'content_icons'    => false,
  2362.           'style'            => "default",
  2363.       );

  2364.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida']) || !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2365.       { 
  2366.       $this->Ini->Color_bg_ajax            = (!isset($str_ajax_bg)       || "" == trim($str_ajax_bg))         ? "#000" $str_ajax_bg;
  2367.       $this->Ini->Border_c_ajax            = (!isset($str_ajax_border_c) || "" == trim($str_ajax_border_c))   ? ""     $str_ajax_border_c;
  2368.       $this->Ini->Border_s_ajax            = (!isset($str_ajax_border_s) || "" == trim($str_ajax_border_s))   ? ""     $str_ajax_border_s;
  2369.       $this->Ini->Border_w_ajax            = (!isset($str_ajax_border_w) || "" == trim($str_ajax_border_w))   ? ""     $str_ajax_border_w;
  2370.       $this->Ini->Img_sep_grid             "/" trim($str_toolbar_separator);
  2371.       $this->Ini->grid_table_width         = (!isset($str_grid_table_width) || "" == trim($str_grid_table_width)) ? "" $str_grid_table_width;
  2372.       $this->Ini->Label_sort_pos           trim($str_label_sort_pos);
  2373.       $this->Ini->Label_sort               trim($str_label_sort);
  2374.       $this->Ini->Label_sort_asc           trim($str_label_sort_asc);
  2375.       $this->Ini->Label_sort_desc          trim($str_label_sort_desc);
  2376.       $this->Ini->Label_summary_sort_pos   trim($str_resume_label_sort_pos);
  2377.       $this->Ini->Label_summary_sort       trim($str_resume_label_sort);
  2378.       $this->Ini->Label_summary_sort_asc   trim($str_resume_label_sort_asc);
  2379.       $this->Ini->Label_summary_sort_desc  trim($str_resume_label_sort_desc);
  2380.       $this->Ini->Sum_ico_line             trim($sum_ico_line);
  2381.       $this->Ini->Sum_ico_column           trim($sum_ico_column);
  2382.       $this->Ini->ajax_div_icon            trim($ajax_div_icon);
  2383.       $this->Ini->Str_toolbarnav_separator '/' trim($str_toolbarnav_separator);
  2384.       $this->Ini->Img_qs_search            '' != trim($img_qs_search)        ? trim($img_qs_search)        : 'scriptcase__NM__qs_lupa.png';
  2385.       $this->Ini->Img_qs_clean             '' != trim($img_qs_clean)         ? trim($img_qs_clean)         : 'scriptcase__NM__qs_close.png';
  2386.       $this->Ini->Str_qs_image_padding     '' != trim($str_qs_image_padding) ? trim($str_qs_image_padding) : '0';
  2387.       $this->Ini->App_div_tree_img_col     trim($app_div_str_tree_col);
  2388.       $this->Ini->App_div_tree_img_exp     trim($app_div_str_tree_exp);
  2389.       $this->Ini->refinedsearch_hide           trim($refinedsearch_hide);
  2390.       $this->Ini->refinedsearch_show          trim($refinedsearch_show);
  2391.       $this->Ini->refinedsearch_close          trim($refinedsearch_close);
  2392.       $this->Ini->refinedsearch_values_separator          trim($refinedsearch_values_separator);
  2393.       $this->Ini->refinedsearch_campo_close_icon          trim($refinedsearch_campo_close_icon);
  2394.           $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_gp_config_btn.php""F""nmButtonOutput") ; 
  2395.           $_SESSION['scriptcase']['css_popup']                 = $this->Ini->str_schema_all "_grid.css";
  2396.           $_SESSION['scriptcase']['css_popup_dir']             = $this->Ini->str_schema_all "_grid" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
  2397.           $_SESSION['scriptcase']['css_btn_popup']             = $this->Ini->Str_btn_css;
  2398.           $_SESSION['scriptcase']['str_google_fonts']          = $this->Ini->str_google_fonts;
  2399.           $_SESSION['scriptcase']['css_popup_tab']             = $this->Ini->str_schema_all "_tab.css";
  2400.           $_SESSION['scriptcase']['css_popup_tab_dir']         = $this->Ini->str_schema_all "_tab" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
  2401.           $_SESSION['scriptcase']['css_popup_div']             = $this->Ini->str_schema_all "_appdiv.css";
  2402.           $_SESSION['scriptcase']['css_popup_div_dir']         = $this->Ini->str_schema_all "_appdiv" $_SESSION['scriptcase']['reg_conf']['css_dir'] . ".css";
  2403.           $_SESSION['scriptcase']['bg_btn_popup']['bok']       = nmButtonOutput($this->arr_buttons"bok_appdiv""processa();""processa();""bok""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2404.           $_SESSION['scriptcase']['bg_btn_popup']['bsair']     = nmButtonOutput($this->arr_buttons"bsair_appdiv""window.close()""window.close()""bsair""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2405.           $_SESSION['scriptcase']['bg_btn_popup']['btbremove'] = nmButtonOutput($this->arr_buttons"bsair_appdiv""self.parent.tb_remove()""self.parent.tb_remove()""bsair""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  2406.       } 
  2407.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order']))
  2408.       { 
  2409.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'][] = "proprietarios_idproprietario";
  2410.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'][] = "proprietarios_nome";
  2411.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'][] = "proprietarios_sexo";
  2412.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'][] = "proprietarios_cpf";
  2413.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'][] = "proprietarios_telefone";
  2414.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'][] = "veiculos_idveiculos";
  2415.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'][] = "veiculos_anomodelo";
  2416.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'][] = "veiculos_placa";
  2417.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'][] = "proprietarios_endereco";
  2418.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order_orig'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'];
  2419.           if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']))
  2420.           { 
  2421.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] = array();
  2422.           } 
  2423.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel']['proprietarios_endereco'] = "off";
  2424.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel_orig'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'];
  2425.       } 
  2426.       if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['exit']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['exit'] != '')
  2427.       {
  2428.           $_SESSION['scriptcase']['sc_url_saida'][$this->Ini->sc_page] = $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['exit'];
  2429.       }

  2430.       $this->Ini->sc_Include($this->Ini->path_libs "/nm_gc.php""F""nm_gc") ; 
  2431.       nm_gc($this->Ini->path_libs);
  2432.       if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'])
  2433.       { 
  2434.           $_SESSION['scriptcase']['sc_page_process'] = $this->Ini->sc_page;
  2435.       } 
  2436.       $_SESSION['scriptcase']['sc_idioma_pivot']['en_us'] = array(
  2437.           'smry_ppup_titl'      => $this->Ini->Nm_lang['lang_othr_smry_ppup_titl'],
  2438.           'smry_ppup_fild'      => $this->Ini->Nm_lang['lang_othr_smry_ppup_fild'],
  2439.           'smry_ppup_posi'      => $this->Ini->Nm_lang['lang_othr_smry_ppup_posi'],
  2440.           'smry_ppup_sort'      => $this->Ini->Nm_lang['lang_othr_smry_ppup_sort'],
  2441.           'smry_ppup_posi_labl' => $this->Ini->Nm_lang['lang_othr_smry_ppup_posi_labl'],
  2442.           'smry_ppup_posi_data' => $this->Ini->Nm_lang['lang_othr_smry_ppup_posi_data'],
  2443.           'smry_ppup_sort_labl' => $this->Ini->Nm_lang['lang_othr_smry_ppup_sort_labl'],
  2444.           'smry_ppup_sort_vlue' => $this->Ini->Nm_lang['lang_othr_smry_ppup_sort_vlue'],
  2445.           'smry_ppup_chek_tabu' => $this->Ini->Nm_lang['lang_othr_smry_ppup_chek_tabu'],
  2446.       );
  2447.       $_SESSION['scriptcase']['sc_tab_meses']['int'] = array(
  2448.                                   $this->Ini->Nm_lang['lang_mnth_janu'],
  2449.                                   $this->Ini->Nm_lang['lang_mnth_febr'],
  2450.                                   $this->Ini->Nm_lang['lang_mnth_marc'],
  2451.                                   $this->Ini->Nm_lang['lang_mnth_apri'],
  2452.                                   $this->Ini->Nm_lang['lang_mnth_mayy'],
  2453.                                   $this->Ini->Nm_lang['lang_mnth_june'],
  2454.                                   $this->Ini->Nm_lang['lang_mnth_july'],
  2455.                                   $this->Ini->Nm_lang['lang_mnth_augu'],
  2456.                                   $this->Ini->Nm_lang['lang_mnth_sept'],
  2457.                                   $this->Ini->Nm_lang['lang_mnth_octo'],
  2458.                                   $this->Ini->Nm_lang['lang_mnth_nove'],
  2459.                                   $this->Ini->Nm_lang['lang_mnth_dece']);
  2460.       $_SESSION['scriptcase']['sc_tab_meses']['abr'] = array(
  2461.                                   $this->Ini->Nm_lang['lang_shrt_mnth_janu'],
  2462.                                   $this->Ini->Nm_lang['lang_shrt_mnth_febr'],
  2463.                                   $this->Ini->Nm_lang['lang_shrt_mnth_marc'],
  2464.                                   $this->Ini->Nm_lang['lang_shrt_mnth_apri'],
  2465.                                   $this->Ini->Nm_lang['lang_shrt_mnth_mayy'],
  2466.                                   $this->Ini->Nm_lang['lang_shrt_mnth_june'],
  2467.                                   $this->Ini->Nm_lang['lang_shrt_mnth_july'],
  2468.                                   $this->Ini->Nm_lang['lang_shrt_mnth_augu'],
  2469.                                   $this->Ini->Nm_lang['lang_shrt_mnth_sept'],
  2470.                                   $this->Ini->Nm_lang['lang_shrt_mnth_octo'],
  2471.                                   $this->Ini->Nm_lang['lang_shrt_mnth_nove'],
  2472.                                   $this->Ini->Nm_lang['lang_shrt_mnth_dece']);
  2473.       $_SESSION['scriptcase']['sc_tab_dias']['int'] = array(
  2474.                                   $this->Ini->Nm_lang['lang_days_sund'],
  2475.                                   $this->Ini->Nm_lang['lang_days_mond'],
  2476.                                   $this->Ini->Nm_lang['lang_days_tued'],
  2477.                                   $this->Ini->Nm_lang['lang_days_wend'],
  2478.                                   $this->Ini->Nm_lang['lang_days_thud'],
  2479.                                   $this->Ini->Nm_lang['lang_days_frid'],
  2480.                                   $this->Ini->Nm_lang['lang_days_satd']);
  2481.       $_SESSION['scriptcase']['sc_tab_dias']['abr'] = array(
  2482.                                   $this->Ini->Nm_lang['lang_shrt_days_sund'],
  2483.                                   $this->Ini->Nm_lang['lang_shrt_days_mond'],
  2484.                                   $this->Ini->Nm_lang['lang_shrt_days_tued'],
  2485.                                   $this->Ini->Nm_lang['lang_shrt_days_wend'],
  2486.                                   $this->Ini->Nm_lang['lang_shrt_days_thud'],
  2487.                                   $this->Ini->Nm_lang['lang_shrt_days_frid'],
  2488.                                   $this->Ini->Nm_lang['lang_shrt_days_satd']);
  2489.       if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'])
  2490.       { 
  2491.           $this->pdf_zip = (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['opc_pdf']['pdf_zip'])) ? $_SESSION['sc_session'][$script_case_init]['grid_new']['opc_pdf']['pdf_zip'] : "N";
  2492.           $_SESSION['sc_session'][$script_case_init]['grid_new']['use_pass_pdf'] = "";
  2493.           $_SESSION['scriptcase']['sc_tp_pdf'] = "wkhtmltopdf";
  2494.           $_SESSION['scriptcase']['sc_idioma_pdf'] = array();
  2495.           $_SESSION['scriptcase']['sc_idioma_pdf']['en_us'] = array('titulo' => $this->Ini->Nm_lang['lang_pdff_titl'], 'titulo_colunas' => $this->Ini->Nm_lang['lang_btns_clmn_hint'], 'modules' => $this->Ini->Nm_lang['lang_export_modules'], 'mod_grid' => $this->Ini->Nm_lang['lang_export_mod_grid'], 'mod_resume' => $this->Ini->Nm_lang['lang_export_mod_summary'], 'mod_chart' => $this->Ini->Nm_lang['lang_export_mod_chart'], 'tp_imp' => $this->Ini->Nm_lang['lang_pdff_type'], 'color' => $this->Ini->Nm_lang['lang_pdff_colr'], 'econm' => $this->Ini->Nm_lang['lang_pdff_bndw'], 'tp_pap' => $this->Ini->Nm_lang['lang_pdff_pper'], 'carta' => $this->Ini->Nm_lang['lang_pdff_letr'], 'oficio' => $this->Ini->Nm_lang['lang_pdff_legl'], 'customiz' => $this->Ini->Nm_lang['lang_pdff_cstm'], 'alt_papel' => $this->Ini->Nm_lang['lang_pdff_pper_hgth'], 'larg_papel' => $this->Ini->Nm_lang['lang_pdff_pper_wdth'], 'orient' => $this->Ini->Nm_lang['lang_pdff_pper_orie'], 'retrato' => $this->Ini->Nm_lang['lang_pdff_prtr'], 'paisag' => $this->Ini->Nm_lang['lang_pdff_lnds'], 'book' => $this->Ini->Nm_lang['lang_pdff_bkmk'], 'grafico' => $this->Ini->Nm_lang['lang_pdff_chrt'], 'largura' => $this->Ini->Nm_lang['lang_pdff_wdth'], 'fonte' => $this->Ini->Nm_lang['lang_pdff_font'], 'create' => $this->Ini->Nm_lang['lang_pdff_create'], 'sim' => $this->Ini->Nm_lang['lang_pdff_chrt_yess'], 'nao' => $this->Ini->Nm_lang['lang_pdff_chrt_nooo'], 'chart_level' => $this->Ini->Nm_lang['lang_chart_level_groupby'], 'chart_level' => $this->Ini->Nm_lang['lang_chart_level_groupby'], 'group_general' => $this->Ini->Nm_lang['lang_pdff_group_general'], 'group_chart' => $this->Ini->Nm_lang['lang_pdff_group_chart'], 'pdf_res' => $this->Ini->Nm_lang['lang_app_xls_summry'], 'pdf_cons' => $this->Ini->Nm_lang['lang_app_xls_grid'], 'password' => $this->Ini->Nm_lang['lang_app_xls_pswd'], 'page_break' => $this->Ini->Nm_lang['lang_groupby_break_page_pdf'], 'other_options' => $this->Ini->Nm_lang['lang_app_other_options'], 'label_group' => $this->Ini->Nm_lang['lang_pdf_below_groupby'], 'page_label' => $this->Ini->Nm_lang['lang_pdf_all_pages_title'], 'page_header' => $this->Ini->Nm_lang['lang_pdf_all_pages_header'], 'format_zip' => $this->Ini->Nm_lang['lang_export_pdf_zip'], 'cancela' => $this->Ini->Nm_lang['lang_pdff_cncl']);
  2496.       } 
  2497.       $_SESSION['scriptcase']['sc_idioma_graf_flash'] = array();
  2498.       $_SESSION['scriptcase']['sc_idioma_graf_flash']['en_us'] = array(
  2499.           'titulo' => $this->Ini->Nm_lang['lang_chrt_titl'],
  2500.           'titulo_colunas' => $this->Ini->Nm_lang['lang_btns_clmn_hint'],
  2501.           'tipo_g' => $this->Ini->Nm_lang['lang_chrt_type'],
  2502.           'tp_barra' => $this->Ini->Nm_lang['lang_flsh_chrt_bars'],
  2503.           'tp_pizza' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie'],
  2504.           'tp_linha' => $this->Ini->Nm_lang['lang_flsh_chrt_line'],
  2505.           'tp_area' => $this->Ini->Nm_lang['lang_flsh_chrt_area'],
  2506.           'tp_marcador' => $this->Ini->Nm_lang['lang_flsh_chrt_mrks'],
  2507.           'tp_gauge' => $this->Ini->Nm_lang['lang_flsh_chrt_gaug'],
  2508.           'tp_radar' => $this->Ini->Nm_lang['lang_flsh_chrt_radr'],
  2509.           'tp_polar' => $this->Ini->Nm_lang['lang_flsh_chrt_polr'],
  2510.           'tp_funil' => $this->Ini->Nm_lang['lang_flsh_chrt_funl'],
  2511.           'tp_pyramid' => $this->Ini->Nm_lang['lang_flsh_chrt_pyrm'],
  2512.           'largura' => $this->Ini->Nm_lang['lang_chrt_wdth'],
  2513.           'altura' => $this->Ini->Nm_lang['lang_chrt_hgth'],
  2514.           'modo_gera' => $this->Ini->Nm_lang['lang_chrt_gtmd'],
  2515.           'sintetico' => $this->Ini->Nm_lang['lang_chrt_smzd'],
  2516.           'analitico' => $this->Ini->Nm_lang['lang_chrt_anlt'],
  2517.           'order' => $this->Ini->Nm_lang['lang_chrt_ordr'],
  2518.           'order_none' => $this->Ini->Nm_lang['lang_chrt_ordr_none'],
  2519.           'order_asc' => $this->Ini->Nm_lang['lang_chrt_ordr_asc'],
  2520.           'order_desc' => $this->Ini->Nm_lang['lang_chrt_ordr_desc'],
  2521.           'barra_orien' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_layo'],
  2522.           'barra_orien_horiz' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_horz'],
  2523.           'barra_orien_verti' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_vrtc'],
  2524.           'barra_forma' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_shpe'],
  2525.           'barra_forma_barra' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_bars'],
  2526.           'barra_forma_cilin' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_cyld'],
  2527.           'barra_forma_cone' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_cone'],
  2528.           'barra_forma_piram' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_pyrm'],
  2529.           'barra_dimen' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_dmns'],
  2530.           'barra_dimen_2d' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_2ddm'],
  2531.           'barra_dimen_3d' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_3ddm'],
  2532.           'barra_sobre' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_3ovr'],
  2533.           'barra_sobre_nao' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_3ont'],
  2534.           'barra_sobre_sim' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_3oys'],
  2535.           'barra_empil' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_stck'],
  2536.           'barra_empil_desat' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_stan'],
  2537.           'barra_empil_ativa' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_stay'],
  2538.           'barra_empil_perce' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_stap'],
  2539.           'barra_inver' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_invr'],
  2540.           'barra_inver_norma' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_invn'],
  2541.           'barra_inver_inver' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_invi'],
  2542.           'barra_agrup' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_srgr'],
  2543.           'barra_agrup_conju' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_srst'],
  2544.           'barra_agrup_serie' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_srbs'],
  2545.           'barra_funil' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_funl'],
  2546.           'barra_funil_nao' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_3ont'],
  2547.           'barra_funil_sim' => $this->Ini->Nm_lang['lang_flsh_chrt_bars_3oys'],
  2548.           'pizza_forma' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_shpe'],
  2549.           'pizza_forma_pizza' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_fpie'],
  2550.           'pizza_forma_donut' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_dnts'],
  2551.           'pizza_dimen' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_dmns'],
  2552.           'pizza_dimen_2d' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_2ddm'],
  2553.           'pizza_dimen_3d' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_3ddm'],
  2554.           'pizza_orden' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_srtn'],
  2555.           'pizza_orden_desat' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_nsrt'],
  2556.           'pizza_orden_ascen' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_asrt'],
  2557.           'pizza_orden_desce' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_dsrt'],
  2558.           'pizza_explo' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_expl'],
  2559.           'pizza_explo_desat' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_dxpl'],
  2560.           'pizza_explo_ativa' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_axpl'],
  2561.           'pizza_explo_click' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_cxpl'],
  2562.           'pizza_valor' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_fval'],
  2563.           'pizza_valor_valor' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_fvlv'],
  2564.           'pizza_valor_perce' => $this->Ini->Nm_lang['lang_flsh_chrt_fpie_fvlp'],
  2565.           'linha_forma' => $this->Ini->Nm_lang['lang_flsh_chrt_line_shpe'],
  2566.           'linha_forma_linha' => $this->Ini->Nm_lang['lang_flsh_chrt_line_line'],
  2567.           'linha_forma_splin' => $this->Ini->Nm_lang['lang_flsh_chrt_line_spln'],
  2568.           'linha_forma_degra' => $this->Ini->Nm_lang['lang_flsh_chrt_line_step'],
  2569.           'linha_inver' => $this->Ini->Nm_lang['lang_flsh_chrt_line_invr'],
  2570.           'linha_inver_norma' => $this->Ini->Nm_lang['lang_flsh_chrt_line_invn'],
  2571.           'linha_inver_inver' => $this->Ini->Nm_lang['lang_flsh_chrt_line_invi'],
  2572.           'linha_agrup' => $this->Ini->Nm_lang['lang_flsh_chrt_line_srgr'],
  2573.           'linha_agrup_conju' => $this->Ini->Nm_lang['lang_flsh_chrt_line_srst'],
  2574.           'linha_agrup_serie' => $this->Ini->Nm_lang['lang_flsh_chrt_line_srbs'],
  2575.           'area_forma' => $this->Ini->Nm_lang['lang_flsh_chrt_area_shpe'],
  2576.           'area_forma_area' => $this->Ini->Nm_lang['lang_flsh_chrt_area_area'],
  2577.           'area_forma_splin' => $this->Ini->Nm_lang['lang_flsh_chrt_area_spln'],
  2578.           'area_empil' => $this->Ini->Nm_lang['lang_flsh_chrt_area_stak'],
  2579.           'area_empil_desat' => $this->Ini->Nm_lang['lang_flsh_chrt_area_stan'],
  2580.           'area_empil_ativa' => $this->Ini->Nm_lang['lang_flsh_chrt_area_stay'],
  2581.           'area_empil_perce' => $this->Ini->Nm_lang['lang_flsh_chrt_area_stap'],
  2582.           'area_inver' => $this->Ini->Nm_lang['lang_flsh_chrt_area_invr'],
  2583.           'area_inver_norma' => $this->Ini->Nm_lang['lang_flsh_chrt_area_invn'],
  2584.           'area_inver_inver' => $this->Ini->Nm_lang['lang_flsh_chrt_area_invi'],
  2585.           'area_agrup' => $this->Ini->Nm_lang['lang_flsh_chrt_area_srgr'],
  2586.           'area_agrup_conju' => $this->Ini->Nm_lang['lang_flsh_chrt_area_srst'],
  2587.           'area_agrup_serie' => $this->Ini->Nm_lang['lang_flsh_chrt_area_srbs'],
  2588.           'marca_inver' => $this->Ini->Nm_lang['lang_flsh_chrt_mrks_invr'],
  2589.           'marca_inver_norma' => $this->Ini->Nm_lang['lang_flsh_chrt_mrks_invn'],
  2590.           'marca_inver_inver' => $this->Ini->Nm_lang['lang_flsh_chrt_mrks_invi'],
  2591.           'marca_agrup' => $this->Ini->Nm_lang['lang_flsh_chrt_mrks_srgr'],
  2592.           'marca_agrup_conju' => $this->Ini->Nm_lang['lang_flsh_chrt_mrks_srst'],
  2593.           'marca_agrup_serie' => $this->Ini->Nm_lang['lang_flsh_chrt_mrks_srbs'],
  2594.           'gauge_forma' => $this->Ini->Nm_lang['lang_flsh_chrt_gaug_shpe'],
  2595.           'gauge_forma_circular' => $this->Ini->Nm_lang['lang_flsh_chrt_gaug_circ'],
  2596.           'gauge_forma_semi' => $this->Ini->Nm_lang['lang_flsh_chrt_gaug_semi'],
  2597.           'pyram_slice' => $this->Ini->Nm_lang['lang_flsh_chrt_pyrm_slic'],
  2598.           'pyram_slice_s' => $this->Ini->Nm_lang['lang_flsh_chrt_pyrm_opcs'],
  2599.           'pyram_slice_n' => $this->Ini->Nm_lang['lang_flsh_chrt_pyrm_opcn'],
  2600.       );
  2601.       if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'])
  2602.       { 
  2603.           $_SESSION['scriptcase']['sc_idioma_prt'] = array();
  2604.           $_SESSION['scriptcase']['sc_idioma_prt']['en_us'] = array('titulo' => $this->Ini->Nm_lang['lang_btns_prtn_titl_hint'], 'modules' => $this->Ini->Nm_lang['lang_export_modules'], 'mod_grid' => $this->Ini->Nm_lang['lang_export_mod_grid'], 'mod_resume' => $this->Ini->Nm_lang['lang_export_mod_summary'], 'mod_chart' => $this->Ini->Nm_lang['lang_export_mod_chart'], 'group_general' => $this->Ini->Nm_lang['lang_pdff_group_general'], 'titulo_colunas' => $this->Ini->Nm_lang['lang_btns_clmn_hint'], 'modoimp' => $this->Ini->Nm_lang['lang_btns_mode_prnt_hint'], 'curr' => $this->Ini->Nm_lang['lang_othr_curr_page'], 'total' => $this->Ini->Nm_lang['lang_othr_full'], 'cor' => $this->Ini->Nm_lang['lang_othr_prtc'], 'pb' => $this->Ini->Nm_lang['lang_othr_bndw'], 'color' => $this->Ini->Nm_lang['lang_othr_colr'], 'pdf_res' => $this->Ini->Nm_lang['lang_app_xls_summry'], 'pdf_cons' => $this->Ini->Nm_lang['lang_app_xls_grid'], 'cancela' => $this->Ini->Nm_lang['lang_btns_cncl_prnt_hint'], 'password' => $this->Ini->Nm_lang['lang_app_xls_pswd']);
  2605.       } 
  2606.       if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'])
  2607.       { 
  2608.           $_SESSION['scriptcase']['sc_idioma_word'] = array();
  2609.           $_SESSION['scriptcase']['sc_idioma_word']['en_us'] = array('titulo' => $this->Ini->Nm_lang['lang_export_title'], 'modules' => $this->Ini->Nm_lang['lang_export_modules'], 'mod_grid' => $this->Ini->Nm_lang['lang_export_mod_grid'], 'mod_resume' => $this->Ini->Nm_lang['lang_export_mod_summary'], 'mod_chart' => $this->Ini->Nm_lang['lang_export_mod_chart'], 'group_general' => $this->Ini->Nm_lang['lang_pdff_group_general'], 'titulo_colunas' => $this->Ini->Nm_lang['lang_btns_clmn_hint'], 'cor' => $this->Ini->Nm_lang['lang_othr_prtc'], 'pb' => $this->Ini->Nm_lang['lang_othr_bndw'], 'color' => $this->Ini->Nm_lang['lang_othr_colr'], 'cancela' => $this->Ini->Nm_lang['lang_btns_cncl_prnt_hint'], 'password' => $this->Ini->Nm_lang['lang_app_xls_pswd']);
  2610.       } 
  2611.       if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'])
  2612.       { 
  2613.           $_SESSION['scriptcase']['sc_idioma_csv'] = array();
  2614.           $_SESSION['scriptcase']['sc_idioma_csv']['en_us'] = array('titulo' => $this->Ini->Nm_lang['lang_app_csv_title'], 'group_general' => $this->Ini->Nm_lang['lang_pdff_group_general'], 'titulo_colunas' => $this->Ini->Nm_lang['lang_btns_clmn_hint'], 'modules' => $this->Ini->Nm_lang['lang_export_modules'], 'mod_grid' => $this->Ini->Nm_lang['lang_export_mod_grid'], 'mod_resume' => $this->Ini->Nm_lang['lang_export_mod_summary'], 'mod_chart' => $this->Ini->Nm_lang['lang_export_mod_chart'], 'delim_line' => $this->Ini->Nm_lang['lang_app_csv_lin_separator'], 'delim_col' => $this->Ini->Nm_lang['lang_app_csv_col_separator'], 'delim_dados' => $this->Ini->Nm_lang['lang_app_csv_txt_separator'], 'label_csv' => $this->Ini->Nm_lang['lang_app_csv_grid_label'], 'password' => $this->Ini->Nm_lang['lang_app_xls_pswd']);
  2615.       } 
  2616.       if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'])
  2617.       { 
  2618.           $_SESSION['scriptcase']['sc_idioma_xml'] = array();
  2619.           $_SESSION['scriptcase']['sc_idioma_xml']['en_us'] = array('titulo' => $this->Ini->Nm_lang['lang_export_title'], 'group_general' => $this->Ini->Nm_lang['lang_pdff_group_general'], 'titulo_colunas' => $this->Ini->Nm_lang['lang_btns_clmn_hint'], 'modules' => $this->Ini->Nm_lang['lang_export_modules'], 'mod_grid' => $this->Ini->Nm_lang['lang_export_mod_grid'], 'mod_resume' => $this->Ini->Nm_lang['lang_export_mod_summary'], 'mod_chart' => $this->Ini->Nm_lang['lang_export_mod_chart'], 'xml_label' => $this->Ini->Nm_lang['lang_inherit_label'], 'xml_yes' => $this->Ini->Nm_lang['lang_pdff_chrt_yess'], 'xml_no' => $this->Ini->Nm_lang['lang_pdff_chrt_nooo'], 'xml_format' => $this->Ini->Nm_lang['lang_xml_tag_attr'], 'xml_attr' => $this->Ini->Nm_lang['lang_xml_formt_attr'], 'xml_tag' => $this->Ini->Nm_lang['lang_xml_formt_tag'], 'password' => $this->Ini->Nm_lang['lang_app_xls_pswd']);
  2620.       } 
  2621.       if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'])
  2622.       { 
  2623.           $_SESSION['scriptcase']['sc_idioma_xls'] = array();
  2624.           $_SESSION['scriptcase']['sc_idioma_xls']['en_us'] = array('titulo' => $this->Ini->Nm_lang['lang_app_xls_title'], 'modules' => $this->Ini->Nm_lang['lang_export_modules'], 'mod_grid' => $this->Ini->Nm_lang['lang_export_mod_grid'], 'mod_resume' => $this->Ini->Nm_lang['lang_export_mod_summary'], 'mod_chart' => $this->Ini->Nm_lang['lang_export_mod_chart'], 'group_general' => $this->Ini->Nm_lang['lang_pdff_group_general'], 'titulo_colunas' => $this->Ini->Nm_lang['lang_btns_clmn_hint'], 'tp_xls' => $this->Ini->Nm_lang['lang_app_xls_ext'], 'tot_xls' => $this->Ini->Nm_lang['lang_othr_export_excel_total'], 'xls_res' => $this->Ini->Nm_lang['lang_app_xls_summry'], 'xls_cons' => $this->Ini->Nm_lang['lang_app_xls_grid'], 'password' => $this->Ini->Nm_lang['lang_app_xls_pswd']);
  2625.       } 
  2626.       $this->Ini->Gd_missing  true;
  2627.       if (function_exists("getProdVersion"))
  2628.       {
  2629.           $_SESSION['scriptcase']['sc_prod_Version'] = str_replace("."""getProdVersion($this->Ini->path_libs));
  2630.       }
  2631.       if (function_exists("gd_info"))
  2632.       {
  2633.           $this->Ini->Gd_missing false;
  2634.       }
  2635.       $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_trata_img.php""C""nm_trata_img") ; 
  2636.       if ((!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']) || empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']) || !isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'])))
  2637.       {
  2638.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "inicio";
  2639.       }
  2640.       if (isset($_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['grid_new']['start'] == 'filter')
  2641.       {
  2642.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "inicio" || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "grid")  
  2643.           { 
  2644.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "busca";
  2645.           }   
  2646.       }
  2647.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "detalhe" && (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig']) || !empty($nmgp_parms) || !empty($GLOBALS["nmgp_parms"])))
  2648.       {
  2649.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga'] = array();  
  2650.           if (isset($NMSC_conf_apl) && !empty($NMSC_conf_apl))
  2651.           { 
  2652.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga'] = $NMSC_conf_apl;  
  2653.           }   
  2654.           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['inicial']))
  2655.           {
  2656.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['inicial'];
  2657.           }
  2658.       }
  2659.           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['paginacao']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['paginacao']))
  2660.           { 
  2661.               $this->Ini->Apl_paginacao $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opc_liga']['paginacao'];
  2662.           } 
  2663.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'] && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "busca")
  2664.       { 
  2665.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "grid" ;  
  2666.       }   
  2667.       if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print']) || empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print']))  
  2668.       { 
  2669.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao_print'] = "inicio" ;  
  2670.       }   
  2671.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_all'] = false;
  2672.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "print")  
  2673.       { 
  2674.           if (strpos(" " $this->Ini->SC_module_export"grid") === false)
  2675.           { 
  2676.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "res_print";
  2677.           }
  2678.       } 
  2679.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "res_print")  
  2680.       { 
  2681.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']     = "resumo";
  2682.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_all'] = true;
  2683.           if (strpos(" " $this->Ini->SC_module_export"grid") !== false)
  2684.           { 
  2685.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "print";
  2686.               $nmgp_tipo_print "RC";
  2687.           }
  2688.       } 
  2689.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['det_print'] = "";
  2690.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "det_print")  
  2691.       { 
  2692.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']     = "detalhe";
  2693.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['det_print'] = "print";
  2694.           if (!empty($nmgp_password)) {
  2695.               $this->Ini->Export_det_zip true;
  2696.           }
  2697.           if ($this->Ini->Export_det_zip)
  2698.           {
  2699.               $this->Ini->Export_img_zip true;
  2700.               $nm_arquivo_html "/sc_grid_new_det_" session_id() . ".html";
  2701.               $nm_saida->seta_arquivo($this->Ini->root $this->Ini->path_imag_temp $nm_arquivo_html);
  2702.           }
  2703.       } 
  2704.       if (substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'], 07) == "grafico")  
  2705.       { 
  2706.           $_SESSION['scriptcase']['sc_ctl_ajax'] = 'part';
  2707.       } 
  2708.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "pdf")
  2709.       { 
  2710.           $this->Ini->path_img_modelo $this->Ini->path_img_modelo;
  2711.       } 
  2712.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "fast_search")  
  2713.       { 
  2714.           $this->SC_fast_search($GLOBALS["nmgp_fast_search"], $GLOBALS["nmgp_cond_fast_search"], $GLOBALS["nmgp_arg_fast_search"]);
  2715.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'] == $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'])
  2716.           { 
  2717.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = 'igual';
  2718.           } 
  2719.           else 
  2720.           { 
  2721.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  2722.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_array_resumo'] = "NAO";
  2723.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral']  = "NAO";
  2724.               unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral']);
  2725.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = 'pesq';
  2726.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq'] = 'grid';
  2727.           } 
  2728.       } 
  2729.       $this->Ini->grid_search_change_fil false;
  2730.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "grid_search" || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "grid_search_res")
  2731.       { 
  2732.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "grid_search")
  2733.           { 
  2734.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq'] = 'grid';
  2735.           } 
  2736.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "grid_search_res")
  2737.           { 
  2738.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq'] = 'res';
  2739.           } 
  2740.           $this->SC_proc_grid_search($_POST['parm']);
  2741.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  2742.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_array_resumo'] = "NAO";
  2743.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral']  = "NAO";
  2744.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral']);
  2745.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = 'pesq';
  2746.       } 
  2747.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "grid_search_change_fil" || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "grid_search_change_fil_res")
  2748.       { 
  2749.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "grid_search_change_fil")
  2750.           { 
  2751.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq'] = 'grid';
  2752.           } 
  2753.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "grid_search_change_fil_res")
  2754.           { 
  2755.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq'] = 'res';
  2756.           } 
  2757.           if (!$_SESSION['scriptcase']['proc_mobile']) 
  2758.           { 
  2759.               require_once($this->Ini->path_aplicacao "grid_new_pesq.class.php"); 
  2760.           } 
  2761.           else 
  2762.           { 
  2763.               require_once($this->Ini->path_aplicacao "grid_new_mobile_pesq.class.php"); 
  2764.           } 
  2765.           $this->pesq  = new grid_new_pesq();
  2766.           $this->prep_modulos("pesq");
  2767.           $this->pesq->NM_ajax_grid_fil $_POST['parm'];
  2768.           $this->pesq->NM_ajax_flag     true;
  2769.           $this->pesq->NM_ajax_opcao    "ajax_grid_search_change_fil";
  2770.           $staus_fil $this->pesq->monta_busca();
  2771.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'];
  2772.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_array_resumo'] = "NAO";
  2773.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral']  = "NAO";
  2774.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral']);
  2775.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = 'pesq';
  2776.           $this->Ini->grid_search_change_fil true;
  2777.       } 
  2778.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == 'pesq' && isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq']))  
  2779.       { 
  2780.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq'] == "res")  
  2781.           { 
  2782.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = 'resumo';
  2783.           } 
  2784.           elseif ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['orig_pesq'] == "grid"
  2785.           { 
  2786.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = 'inicio';
  2787.           } 
  2788.       } 
  2789. //
  2790.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['prim_cons'] = false;  
  2791.       if (substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'], 07) != "grafico" && $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "detalhe" && (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig']) || !empty($nmgp_parms) || !empty($GLOBALS["nmgp_parms"])))  
  2792.       { 
  2793.          unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['use_pass_pdf']);
  2794.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['prim_cons'] = true;  
  2795.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'] = "";
  2796.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq']       = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];  
  2797.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant']   = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'];  
  2798.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['cond_pesq'] = ""
  2799.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] = "";
  2800.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'] = "";
  2801.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral'] = "NAO";
  2802.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['sc_total']);
  2803.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tot_geral']);
  2804.          $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_array_resumo'] = "NAO";
  2805.       } 
  2806.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_ant'];  
  2807.       $nm_flag_pdf   true;
  2808.       $nm_vendo_pdf  = ("pdf" == $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']);
  2809.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['graf_pdf'] = "S";
  2810.       if (isset($nmgp_graf_pdf) && !empty($nmgp_graf_pdf))
  2811.       {
  2812.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['graf_pdf'] = $nmgp_graf_pdf;
  2813.       }
  2814.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2815.       {
  2816.          if ($nm_flag_pdf && $nm_vendo_pdf)
  2817.          {
  2818.             $nm_arquivo_htm_temp $this->Ini->root $this->Ini->path_imag_temp "/sc_grid_new_html_" session_id() . "_2.html";
  2819.             if (isset($_GET['pdf_base']) && isset($_GET['pdf_url']))
  2820.             {
  2821.                 $nm_arquivo_pdf_base "/" str_replace("_NMPLUS_""+"$_GET['pdf_base']);
  2822.                 $nm_arquivo_pdf_url  $_GET['pdf_url'] . $nm_arquivo_pdf_base;
  2823.             }
  2824.             else
  2825.             {
  2826.                 $nm_arquivo_pdf_base "/sc_pdf_" date("YmdHis") . "_" rand(01000) . "_grid_new.pdf";
  2827.                 $nm_arquivo_pdf_url  $this->Ini->path_imag_temp $nm_arquivo_pdf_base;
  2828.             }
  2829.             $nm_arquivo_pdf_serv $this->Ini->root $nm_arquivo_pdf_url;
  2830.             $nm_arquivo_de_saida $this->Ini->root $this->Ini->path_imag_temp "/sc_grid_new_html_" session_id() . ".html";
  2831.             $nm_url_de_saida $this->Ini->server_pdf $this->Ini->path_imag_temp "/sc_grid_new_html_" session_id() . ".html";
  2832.             if (in_array(trim($this->Ini->str_lang), $this->Ini->nm_font_ttf) && strtolower($_SESSION['scriptcase']['charset']) != "utf-8")
  2833.             { 
  2834.                 $nm_saida->seta_arquivo($nm_arquivo_de_saida$_SESSION['scriptcase']['charset']);
  2835.             }
  2836.             else
  2837.             { 
  2838.                 $nm_saida->seta_arquivo($nm_arquivo_de_saida);
  2839.             }
  2840.          }
  2841.       }
  2842. //----------------------------------->
  2843.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "doc_word_res")
  2844.       { 
  2845.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_navigator'] = "Microsoft Internet Explorer";
  2846.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_all'] = true;
  2847.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word']  = true;
  2848.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']     = "resumo";
  2849.           $_SESSION['scriptcase']['saida_word'] = true;
  2850.           if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_name']))
  2851.           {
  2852.               $nm_arquivo_doc_word "/" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_name'];
  2853.           }
  2854.           else
  2855.           {
  2856.               $nm_arquivo_doc_word "/sc_grid_new_res_" session_id() . ".doc";
  2857.           }
  2858.           $nm_saida->seta_arquivo($this->Ini->root $this->Ini->path_imag_temp $nm_arquivo_doc_word);
  2859.           $this->Ini->nm_limite_lin_res_prt 0;
  2860.           $GLOBALS['nmgp_cor_print']        = "CO";
  2861.       } 
  2862.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "xls")  
  2863.       { 
  2864.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2865.           { 
  2866.               require_once($this->Ini->path_embutida "grid_new/grid_new_xls.class.php"); 
  2867.           } 
  2868.           else 
  2869.           { 
  2870.               require_once($this->Ini->path_aplicacao "grid_new_xls.class.php"); 
  2871.           } 
  2872.           $this->xls  = new grid_new_xls();
  2873.           $this->prep_modulos("xls");
  2874.           $this->xls->monta_xls();
  2875.       }
  2876.       else
  2877.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "xls_res")  
  2878.       { 
  2879.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2880.           { 
  2881.               require_once($this->Ini->path_embutida "grid_new/grid_new_res_xls.class.php"); 
  2882.           } 
  2883.           else 
  2884.           { 
  2885.               require_once($this->Ini->path_aplicacao "grid_new_res_xls.class.php"); 
  2886.           } 
  2887.           $this->xls  = new grid_new_res_xls();
  2888.           $this->prep_modulos("xls");
  2889.           $this->xls->monta_xls();
  2890.       }
  2891.       else
  2892.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "xml")  
  2893.       { 
  2894.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2895.           { 
  2896.               require_once($this->Ini->path_embutida "grid_new/grid_new_xml.class.php"); 
  2897.           } 
  2898.           else 
  2899.           { 
  2900.               require_once($this->Ini->path_aplicacao "grid_new_xml.class.php"); 
  2901.           } 
  2902.           $this->xml  = new grid_new_xml();
  2903.           $this->prep_modulos("xml");
  2904.           $this->xml->monta_xml();
  2905.       }
  2906.       else
  2907.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "xml_res")  
  2908.       { 
  2909.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2910.           { 
  2911.               require_once($this->Ini->path_embutida "grid_new/grid_new_res_xml.class.php"); 
  2912.           } 
  2913.           else 
  2914.           { 
  2915.               require_once($this->Ini->path_aplicacao "grid_new_res_xml.class.php"); 
  2916.           } 
  2917.           $this->xml  = new grid_new_res_xml();
  2918.           $this->prep_modulos("xml");
  2919.           $this->xml->monta_xml();
  2920.       }
  2921.       else
  2922.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "csv")  
  2923.       { 
  2924.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2925.           { 
  2926.               require_once($this->Ini->path_embutida "grid_new/grid_new_csv.class.php"); 
  2927.           } 
  2928.           else 
  2929.           { 
  2930.               require_once($this->Ini->path_aplicacao "grid_new_csv.class.php"); 
  2931.           } 
  2932.           $this->csv  = new grid_new_csv();
  2933.           $this->prep_modulos("csv");
  2934.           $this->csv->monta_csv();
  2935.       }
  2936.       else   
  2937.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "csv_res")  
  2938.       { 
  2939.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2940.           { 
  2941.               require_once($this->Ini->path_embutida "grid_new/grid_new_res_csv.class.php"); 
  2942.           } 
  2943.           else 
  2944.           { 
  2945.               require_once($this->Ini->path_aplicacao "grid_new_res_csv.class.php"); 
  2946.           } 
  2947.           $this->csv  = new grid_new_res_csv();
  2948.           $this->prep_modulos("csv");
  2949.           $this->csv->monta_csv();
  2950.       }
  2951.       else   
  2952.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "rtf")  
  2953.       { 
  2954.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2955.           { 
  2956.               require_once($this->Ini->path_embutida "grid_new/grid_new_rtf.class.php"); 
  2957.           } 
  2958.           else 
  2959.           { 
  2960.               require_once($this->Ini->path_aplicacao "grid_new_rtf.class.php"); 
  2961.           } 
  2962.           $this->rtf  = new grid_new_rtf();
  2963.           $this->prep_modulos("rtf");
  2964.           $this->rtf->monta_rtf();
  2965.       }
  2966.       else
  2967.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "rtf_res")  
  2968.       { 
  2969.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2970.           { 
  2971.               require_once($this->Ini->path_embutida "grid_new/grid_new_res_rtf.class.php"); 
  2972.           } 
  2973.           else 
  2974.           { 
  2975.               require_once($this->Ini->path_aplicacao "grid_new_res_rtf.class.php"); 
  2976.           } 
  2977.           $this->rtf  = new grid_new_res_rtf();
  2978.           $this->prep_modulos("rtf");
  2979.           $this->rtf->monta_rtf();
  2980.       }
  2981.       else
  2982.       if (substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'], 07) == "grafico")  
  2983.       { 
  2984.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  2985.           { 
  2986.               require_once($this->Ini->path_embutida " . grid_new . /" $this->Ini->Apl_grafico); 
  2987.           } 
  2988.           else 
  2989.           { 
  2990.               require_once($this->Ini->path_aplicacao $this->Ini->Apl_grafico); 
  2991.           } 
  2992.           $this->Graf  = new grid_new_grafico();
  2993.           $this->prep_modulos("Graf");
  2994.           if (substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'], 71) == "_")  
  2995.           { 
  2996.               $this->Graf->grafico_col(substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'], 8));
  2997.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "grid";
  2998.           }
  2999.           else
  3000.           { 
  3001.               if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_refresh_after_chart'])) {
  3002.                   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_refresh_after_chart'];
  3003.                   unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['dashboard_refresh_after_chart']);
  3004.               }
  3005.               else {
  3006.                   $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] = "grid";
  3007.               }
  3008.               $this->Graf->monta_grafico();
  3009.           }
  3010.       }
  3011.       else 
  3012.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "busca")  
  3013.       { 
  3014.           if (!$_SESSION['scriptcase']['proc_mobile']) 
  3015.           { 
  3016.               require_once($this->Ini->path_aplicacao "grid_new_pesq.class.php"); 
  3017.           } 
  3018.           else 
  3019.           { 
  3020.               require_once($this->Ini->path_aplicacao "grid_new_mobile_pesq.class.php"); 
  3021.           } 
  3022.           $this->pesq  = new grid_new_pesq();
  3023.           $this->prep_modulos("pesq");
  3024.           $this->pesq->NM_ajax_flag    $this->NM_ajax_flag;
  3025.           $this->pesq->NM_ajax_opcao   $this->NM_ajax_opcao;
  3026.           $this->pesq->monta_busca();
  3027.       }
  3028.       else 
  3029.       if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "resumo")  
  3030.       { 
  3031.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  3032.           { 
  3033.               require_once($this->Ini->path_embutida "grid_new/" $this->Ini->Apl_resumo); 
  3034.           } 
  3035.           else 
  3036.           { 
  3037.               require_once($this->Ini->path_aplicacao $this->Ini->Apl_resumo); 
  3038.           } 
  3039.           $this->Res = new grid_new_resumo("out");
  3040.           $this->prep_modulos("Res");
  3041.           $this->Res->monta_resumo();
  3042.       }
  3043.       else 
  3044.       { 
  3045.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "print" && $nmgp_tipo_print == "RC")
  3046.           { 
  3047.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_navigator'] = $nmgp_navegator_print;
  3048.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_all'] = true;
  3049.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']     = "pdf";
  3050.               $GLOBALS['nmgp_tipo_pdf'] = strtolower($nmgp_cor_print);
  3051.           } 
  3052.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "doc_word")
  3053.           { 
  3054.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_navigator'] = "Microsoft Internet Explorer";
  3055.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['print_all'] = true;
  3056.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word']  = true;
  3057.               $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao']     = "pdf";
  3058.               $_SESSION['scriptcase']['saida_word'] = true;
  3059.               if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_name']))
  3060.               {
  3061.                   $nm_arquivo_doc_word =  "/" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_name'];
  3062.               }
  3063.               else
  3064.               {
  3065.                   $nm_arquivo_doc_word "/sc_grid_new_" session_id() . ".doc";
  3066.               }
  3067.               $nm_saida->seta_arquivo($this->Ini->root $this->Ini->path_imag_temp $nm_arquivo_doc_word);
  3068.               $this->Ini->nm_limite_lin_prt 0;
  3069.               $GLOBALS['nmgp_tipo_pdf'] = "CO";
  3070.           } 
  3071.           if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] == "detalhe" || $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_det'])  
  3072.           { 
  3073.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  3074.               { 
  3075.                   require_once($this->Ini->path_embutida "grid_new/grid_new_det.class.php"); 
  3076.               } 
  3077.               else 
  3078.               { 
  3079.                   require_once($this->Ini->path_aplicacao "grid_new_det.class.php"); 
  3080.               } 
  3081.               $this->det  = new grid_new_det();
  3082.               $this->prep_modulos("det");
  3083.               $this->det->monta_det();
  3084.           } 
  3085.           else  
  3086.           { 
  3087.               if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  3088.               { 
  3089.                   require_once($this->Ini->path_embutida "grid_new/grid_new_grid.class.php"); 
  3090.               } 
  3091.               else 
  3092.               { 
  3093.                   require_once($this->Ini->path_aplicacao "grid_new_grid.class.php"); 
  3094.               } 
  3095.               $this->grid  = new grid_new_grid();
  3096.               $this->prep_modulos("grid");
  3097.               $this->grid->monta_grid($linhas);
  3098.           } 
  3099.       }   
  3100. //--- 
  3101.       if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'])
  3102.       {
  3103.            $this->Db->Close(); 
  3104.       }
  3105.       if ($this->Change_Menu)
  3106.       {
  3107.           $apl_menu  $_SESSION['scriptcase']['menu_atual'];
  3108.           $Arr_rastro = array();
  3109.           if (isset($_SESSION['scriptcase']['menu_apls'][$apl_menu][$this->sc_init_menu]) && count($_SESSION['scriptcase']['menu_apls'][$apl_menu][$this->sc_init_menu]) > 1)
  3110.           {
  3111.               foreach ($_SESSION['scriptcase']['menu_apls'][$apl_menu][$this->sc_init_menu] as $menu => $apls)
  3112.               {
  3113.                  $Arr_rastro[] = "'<a href=\"" $apls['link'] . "?script_case_init=" $this->sc_init_menu "&script_case_session=" session_id() . "\" target=\"#NMIframe#\">" $apls['label'] . "</a>'";
  3114.               }
  3115.               $ult_apl count($Arr_rastro) - 1;
  3116.               unset($Arr_rastro[$ult_apl]);
  3117.               $rastro implode(","$Arr_rastro);
  3118. ?>
  3119.   <script type="text/javascript">
  3120.      link_atual = new Array (<?php echo $rastro ?>);
  3121.      parent.writeFastMenu(link_atual);
  3122.   </script>
  3123. <?php
  3124.           }
  3125.           else
  3126.           {
  3127. ?>
  3128.   <script type="text/javascript">
  3129.      parent.clearFastMenu();
  3130.   </script>
  3131. <?php
  3132.           }
  3133.       }
  3134.       if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['embutida'])
  3135.       {
  3136.          $nm_saida->finaliza();
  3137.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['ajax_nav'])
  3138.          {
  3139.              $Temp ob_get_clean();
  3140.              if ($Temp !== false && trim($Temp) != "")
  3141.              {
  3142.                  $this->Ini->Arr_result['htmOutput'] = $Temp;
  3143.              }
  3144.              if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['opcao'] != "ajax_detalhe")  
  3145.              {
  3146.                  $this->Ini->Arr_result['setVar'][] = array('var' => 'scQtReg''value' => $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['qt_reg_grid']);
  3147.              }
  3148.              $_SESSION['scriptcase']['saida_var'] = false;
  3149.              $oJson = new Services_JSON();
  3150.              echo $oJson->encode($this->Ini->Arr_result);
  3151.              exit;
  3152.          }
  3153.             if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']))
  3154.             {
  3155.                 $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['field_order'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order'];
  3156.                 unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['field_order']);
  3157.             }
  3158.             if(isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']))
  3159.             {
  3160.                 $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['usr_cmp_sel'] = $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel'];
  3161.                 unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['export_sel_columns']['usr_cmp_sel']);
  3162.             }
  3163.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['doc_word'])
  3164.          {
  3165.              $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file'] = $this->Ini->root $this->Ini->path_imag_temp $nm_arquivo_doc_word;
  3166.              $this->html_doc_word($nm_arquivo_doc_word$nmgp_password);
  3167.          }
  3168.          if ($this->Ini->Export_html_zip)
  3169.          {
  3170.              $this->html_export_print($nm_arquivo_html$nmgp_password);
  3171.          }
  3172.          if ($this->Ini->Export_det_zip)
  3173.          {
  3174.              $this->det_export_print($nm_arquivo_html$nmgp_password);
  3175.          }
  3176.          if ($ajax_opc_print)
  3177.          {
  3178.              $this->Arr_result['file_export']  = NM_charset_to_utf8($this->Ini->root $this->Ini->path_imag_temp $nm_arquivo_print ".html");
  3179.              $this->Arr_result['title_export'] = NM_charset_to_utf8($nm_arquivo_print);
  3180.              $Temp ob_get_clean();
  3181.              if ($Temp !== false && trim($Temp) != "")
  3182.              {
  3183.                  $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  3184.              }
  3185.              $oJson = new Services_JSON();
  3186.              echo $oJson->encode($this->Arr_result);
  3187.              exit;
  3188.         }
  3189.          if ($nm_flag_pdf && $nm_vendo_pdf)
  3190.          {
  3191.             if (isset($nmgp_parms_pdf) && !empty($nmgp_parms_pdf))
  3192.             {
  3193.                 $str_pd4ml    $nmgp_parms_pdf;
  3194.             }
  3195.             else
  3196.             {
  3197.                 $str_pd4ml    " --page-size A4 --orientation Portrait";
  3198.             }
  3199.             if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_res'])
  3200.             { 
  3201.                 $str_pd4ml .= " --outline-depth 0";
  3202.             }
  3203.             if (!$this->Ini->sc_export_ajax && !$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_det'])
  3204.             {
  3205.                 if (-$this->grid->progress_grid && $this->grid->progress_fp)
  3206.                 {
  3207.                     $lang_protect $this->Ini->Nm_lang['lang_pdff_gnrt'];
  3208.                     if (!NM_is_utf8($lang_protect))
  3209.                     {
  3210.                         $lang_protect sc_convert_encoding($lang_protect"UTF-8"$_SESSION['scriptcase']['charset']);
  3211.                     }
  3212.                     fwrite($this->grid->progress_fp, ($this->grid->progress_tot) . "_#NM#_" $lang_protect "...\n");
  3213.                     fclose($this->grid->progress_fp);
  3214.                 }
  3215.             }
  3216.             if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_name']))
  3217.             {
  3218.                 $nm_arquivo_pdf_serv $this->Ini->root .  $this->Ini->path_imag_temp "/" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_name'];
  3219.                 $nm_arquivo_pdf_url  $this->Ini->path_imag_temp "/" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_name'];
  3220.                 $nm_arquivo_pdf_base "/" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_name'];
  3221.                 unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_name']);
  3222.             }
  3223.             $arq_pdf_out  = (FALSE !== strpos($nm_arquivo_pdf_serv' ')) ? " \"" $nm_arquivo_pdf_serv "\"" :  $nm_arquivo_pdf_serv;
  3224.             $arq_pdf_in   = (FALSE !== strpos($nm_url_de_saida' '))     ? " \"" $nm_url_de_saida "\""     :  $nm_url_de_saida;
  3225.             if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  3226.             {
  3227.                 $dir_qpdf "/qpdf/win/bin";
  3228.             }
  3229.             elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  3230.             {
  3231.                 if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  3232.                 {
  3233.                     $dir_qpdf "/qpdf/linux-i386";
  3234.                 }
  3235.                 else
  3236.                 {
  3237.                     $dir_qpdf "/qpdf/linux-amd64";
  3238.                 }
  3239.             }
  3240.             elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  3241.             {
  3242.                 $dir_qpdf "/qpdf/osx";
  3243.             }
  3244.             if ($this->pdf_zip == "S")
  3245.             {
  3246.                 $arq_pdf_final str_replace(".pdf"".zip"$arq_pdf_out);
  3247.             }
  3248.             elseif (is_dir($this->Ini->path_third $dir_qpdf) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['use_pass_pdf']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['use_pass_pdf']))
  3249.             {
  3250.                 $arq_pdf_final $arq_pdf_out;
  3251.                 $arq_pdf_out   str_replace(".pdf""_wk.pdf"$arq_pdf_out);
  3252.             }
  3253.             $Win_autentication "";
  3254.             if (isset($_SESSION['sc_pdf_usr']) && !empty($_SESSION['sc_pdf_usr']))
  3255.             {
  3256.                 $_SESSION['sc_iis_usr'] = $_SESSION['sc_pdf_usr'];
  3257.             }
  3258.             if (isset($_SESSION['sc_iis_usr']) && !empty($_SESSION['sc_iis_usr']))
  3259.             {
  3260.                 $Win_autentication .= " --username " $_SESSION['sc_iis_usr'];
  3261.             }
  3262.             if (isset($_SESSION['sc_pdf_pw']) && !empty($_SESSION['sc_pdf_pw']))
  3263.             {
  3264.                 $_SESSION['sc_iis_pw'] = $_SESSION['sc_pdf_pw'];
  3265.             }
  3266.             if (isset($_SESSION['sc_iis_pw']) && !empty($_SESSION['sc_iis_pw']))
  3267.             {
  3268.                 $Win_autentication .= " --password " $_SESSION['sc_iis_pw'];
  3269.             }
  3270.             if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  3271.             {
  3272.                 chdir($this->Ini->path_third "/wkhtmltopdf/win");
  3273.                 $str_execcmd2 'wkhtmltopdf ' $str_pd4ml $Win_autentication ' --header-right "[page]"';
  3274.             }
  3275.             elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  3276.             {
  3277.                 if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  3278.                 {
  3279.                     if (FALSE !== strpos(php_uname(), 'Debian 4.9')) 
  3280.                     {
  3281.                         chdir($this->Ini->path_third "/wkhtmltopdf/stretch");
  3282.                     }
  3283.                     else
  3284.                     {
  3285.                         chdir($this->Ini->path_third "/wkhtmltopdf/linux-i386");
  3286.                     }
  3287.                     $str_execcmd2 './wkhtmltopdf-i386 ' $str_pd4ml $Win_autentication ' --header-right "[page]"';
  3288.                 }
  3289.                 else
  3290.                 {
  3291.                     if (FALSE !== strpos(php_uname(), 'Debian 4.9')) 
  3292.                     {
  3293.                         chdir($this->Ini->path_third "/wkhtmltopdf/stretch");
  3294.                     }
  3295.                     else
  3296.                     {
  3297.                         chdir($this->Ini->path_third "/wkhtmltopdf/linux-amd64");
  3298.                     }
  3299.                     $str_execcmd2 './wkhtmltopdf-amd64 ' $str_pd4ml $Win_autentication ' --header-right "[page]"';
  3300.                 }
  3301.             }
  3302.             elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  3303.             {
  3304.                 chdir($this->Ini->path_third "/wkhtmltopdf/osx/Contents/MacOS");
  3305.                 $str_execcmd2 './wkhtmltopdf ' $str_pd4ml $Win_autentication ' --header-right "[page]"';
  3306.             }

  3307.             if (!isset($_SESSION['scriptcase']['phantomjs_charts']) || !$_SESSION['scriptcase']['phantomjs_charts'])
  3308.             {
  3309.                 $str_execcmd2 .= ' --javascript-delay ' 2000;
  3310.             }

  3311.             $str_execcmd2 .= ' ' $arq_pdf_in ' ' $arq_pdf_out;

  3312.             $arr_execcmd = array();
  3313.             $str_execcmd $str_execcmd2;
  3314.             exec($str_execcmd2);
  3315.             $str_cmd_qpdf "";
  3316.             $str_zip      "";
  3317.             if ($this->pdf_zip == "S")
  3318.             {
  3319.                 $pdf_pass = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['use_pass_pdf'])) ? $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['use_pass_pdf'] : "";
  3320.                 $opt_pass = (!empty($pdf_pass)) ? " -p" "";
  3321.                 if (is_file($arq_pdf_final)) {
  3322.                     unlink($arq_pdf_final);
  3323.                 }
  3324.                 if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  3325.                 {
  3326.                     chdir($this->Ini->path_third "/zip/windows");
  3327.                     $str_zip "zip.exe" strtoupper($opt_pass) . " -j " $pdf_pass " " $arq_pdf_final " " $arq_pdf_out;
  3328.                 }
  3329.                 elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  3330.                 {
  3331.                       if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  3332.                       {
  3333.                           chdir($this->Ini->path_third "/zip/linux-i386/bin");
  3334.                       }
  3335.                       else
  3336.                       {
  3337.                           chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  3338.                       }
  3339.                       $str_zip "./7za" $opt_pass $pdf_pass " a " $arq_pdf_final " " $arq_pdf_out;
  3340.                 }
  3341.                 elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  3342.                 {
  3343.                     chdir($this->Ini->path_third "/zip/mac/bin");
  3344.                     $str_zip "./7za" $opt_pass $pdf_pass " a " $arq_pdf_final " " $arq_pdf_out;
  3345.                 }
  3346.                 if (!empty($str_zip)) {
  3347.                     exec($str_zip);
  3348.                 }
  3349.                 if (is_file($arq_pdf_final)) 
  3350.                 {
  3351.                     unlink($arq_pdf_out);
  3352.                 }
  3353.             }
  3354.             elseif (isset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['use_pass_pdf']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['use_pass_pdf']))
  3355.             {
  3356.                 if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  3357.                 {
  3358.                     $dir_qpdf "/qpdf/win/bin";
  3359.                     $str_cmd_qpdf "qpdf.exe ";
  3360.                 }
  3361.                 elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  3362.                 {
  3363.                     if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  3364.                     {
  3365.                         $dir_qpdf "/qpdf/linux-i386";
  3366.                         $str_cmd_qpdf "./qpdf-linux-x86 ";
  3367.                     }
  3368.                     else
  3369.                     {
  3370.                         $dir_qpdf "/qpdf/linux-amd64";
  3371.                         $str_cmd_qpdf "./qpdf-linux-amd64 ";
  3372.                     }
  3373.                 }
  3374.                 elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  3375.                 {
  3376.                     $dir_qpdf "/qpdf/osx";
  3377.                     $str_cmd_qpdf "./qpdf-darwin-x86 ";
  3378.                 }
  3379.                 if (is_dir($this->Ini->path_third $dir_qpdf)) 
  3380.                 {
  3381.                     chdir($this->Ini->path_third $dir_qpdf);
  3382.                     $pdf_pass  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['use_pass_pdf'];
  3383.                     $str_cmd_qpdf .= "--encrypt " $pdf_pass " " $pdf_pass " 256 -- " $arq_pdf_out " " $arq_pdf_final;
  3384.                     exec($str_cmd_qpdf);
  3385.                     if (is_file($arq_pdf_final)) 
  3386.                     {
  3387.                         unlink($arq_pdf_out);
  3388.                     }
  3389.                 }
  3390.             }
  3391.             $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_array_resumo'] = '';
  3392.             $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['contr_total_geral']  = '';
  3393.             // ----- PDF log
  3394.             $fp = @fopen($this->Ini->root $this->Ini->path_imag_temp str_replace(array(".pdf",".zip"), array("",""), $nm_arquivo_pdf_base) . '.log''w');
  3395.             if ($fp)
  3396.             {
  3397.                 @fwrite($fp$str_execcmd "\r\n\r\n");
  3398.                 @fwrite($fpimplode("\r\n"$arr_execcmd));
  3399.                 @fwrite($fp$str_cmd_qpdf "\r\n\r\n");
  3400.                 @fwrite($fp$str_zip "\r\n\r\n");
  3401.                 @fclose($fp);
  3402.             }
  3403.             if ($this->Ini->sc_export_ajax)
  3404.             {
  3405.                 $this->Arr_result['file_export']  = NM_charset_to_utf8($nm_arquivo_pdf_serv);
  3406.                 $this->Arr_result['title_export'] = NM_charset_to_utf8(substr($nm_arquivo_pdf_base1));
  3407.                 $Temp ob_get_clean();
  3408.                 if ($Temp !== false && trim($Temp) != "")
  3409.                 {
  3410.                     $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  3411.                 }
  3412.                 $oJson = new Services_JSON();
  3413.                 echo $oJson->encode($this->Arr_result);
  3414.                 exit;
  3415.             }
  3416.             if (in_array(trim($this->Ini->str_lang), $this->Ini->nm_font_ttf) && strtolower($_SESSION['scriptcase']['charset']) != "utf-8")
  3417.             { 
  3418.                $_SESSION['scriptcase']['charset_html'] = (isset($this->Ini->sc_charset[$_SESSION['scriptcase']['charset']])) ? $this->Ini->sc_charset[$_SESSION['scriptcase']['charset']] : $_SESSION['scriptcase']['charset'];
  3419.             }
  3420.             if (!$_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_det'])
  3421.             {
  3422.                 if (-$this->grid->progress_grid && $this->grid->progress_fp)
  3423.                 {
  3424.                     $this->grid->progress_fp fopen($_GET['pbfile'], 'a');
  3425.                     if ($this->grid->progress_fp)
  3426.                     {
  3427.                          $lang_protect $this->Ini->Nm_lang['lang_pdff_fnsh'];
  3428.                          if (!NM_is_utf8($lang_protect))
  3429.                          {
  3430.                              $lang_protect sc_convert_encoding($lang_protect"UTF-8"$_SESSION['scriptcase']['charset']);
  3431.                           }
  3432.                         fwrite($this->grid->progress_fp, ($this->grid->progress_now $this->grid->progress_pdf) . "_#NM#_" $lang_protect "...\n");
  3433.                         fwrite($this->grid->progress_fp"off\n");
  3434.                         fclose($this->grid->progress_fp);
  3435.                     }
  3436.                 }
  3437.             }
  3438. unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_file']);
  3439. if (is_file($nm_arquivo_pdf_serv))
  3440. {
  3441.     $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_file'] = $nm_arquivo_pdf_serv;
  3442. }
  3443. if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['pdf_det'])
  3444. {
  3445.     if ($this->pdf_zip == "S")
  3446.     {
  3447.         $nm_arquivo_pdf_url str_replace(".pdf"".zip"$nm_arquivo_pdf_url);
  3448.     }
  3449.     $this->html_pdf_detalhe($nm_arquivo_pdf_url);
  3450.     return;
  3451. }
  3452. $NM_volta  "volta_grid";
  3453. $NM_target "_parent";
  3454. if ($_SESSION['sc_session'][$script_case_init]['grid_new']['pdf_res'])
  3455. {
  3456.   $NM_volta  "resumo";
  3457.   $NM_target "_self";
  3458. ?>
  3459. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  3460.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  3461. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  3462. <HEAD>
  3463.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: PDF</TITLE>
  3464.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
  3465.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?>" GMT">
  3466.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
  3467.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0">
  3468.  <META http-equiv="Pragma" content="no-cache">
  3469.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_grid.css" /> 
  3470.  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_grid<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  3471.  <?php 
  3472.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts)) 
  3473.  { 
  3474.  ?> 
  3475.  <link href="<?php echo $this->Ini->str_google_fonts ?>" rel="stylesheet" /> 
  3476.  <?php 
  3477.  } 
  3478.  ?> 
  3479.  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  3480. </HEAD>
  3481. <BODY>
  3482. <?php echo $this->Ini->Ajax_result_set ?>
  3483. <table class="scGridTabela" valign="top"><tr class="scGridFieldOddVert"><td>
  3484. <?php
  3485. }
  3486.                     $rRFP fopen(urldecode($_GET['pbfile']), "w");
  3487.                     fwrite($rRFP"PDF\n");
  3488.                     fwrite($rRFP"\n");
  3489.                     fwrite($rRFP"\n");
  3490.                     fwrite($rRFP"100\n");
  3491.                     fwrite($rRFP"_#NM#_" $this->Ini->Nm_lang['lang_pdff_gnrt'] . "...\n");
  3492.                     fwrite($rRFP100 "_#NM#_" $this->Ini->Nm_lang['lang_pdff_fnsh'] . "...\n");
  3493.                     fwrite($rRFP"off\n");
  3494.                     fclose($rRFP);
  3495. if (!is_file($nm_arquivo_pdf_serv))
  3496. {
  3497. ?>
  3498.   <br><b><?php echo $this->Ini->Nm_lang['lang_pdff_errg']; ?></b></td></tr></table>
  3499. <?php
  3500. }
  3501. else
  3502. {
  3503. ?>
  3504. <?php echo $this->Ini->Nm_lang['lang_pdff_file_loct']; ?>
  3505. <BR>
  3506. <A href="<?php echo $nm_arquivo_pdf_url?>" target="_blank" class="scGridPageLink"><B><?php echo $nm_arquivo_pdf_url?></B></A>.
  3507. <BR>
  3508. <?php echo $this->Ini->Nm_lang['lang_pdff_clck_mesg']; ?>
  3509. </td></tr></table>
  3510. <?php
  3511. }
  3512.    echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""sc_b_sai""""""""absmiddle""""0px"$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  3513. ?>
  3514. <FORM name="F0" method=post action="./" target="<?php echo $NM_target?>"> 
  3515. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  3516. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  3517. <INPUT type="hidden" name="nmgp_opcao" value="<?php echo NM_encode_input($NM_volta); ?>"> 
  3518. </FORM>
  3519. </td></tr></table>
  3520. </BODY>
  3521. </HTML>
  3522. <?php
  3523.          }
  3524.       }
  3525.    } 
  3526.    function nm_conv_data_db($dt_in$form_in$form_out)
  3527.    {
  3528.        $dt_out $dt_in;
  3529.        if (strtoupper($form_in) == "DB_FORMAT")
  3530.        {
  3531.            if ($dt_out == "null" || $dt_out == "")
  3532.            {
  3533.                $dt_out "";
  3534.                return $dt_out;
  3535.            }
  3536.            $form_in "AAAA-MM-DD";
  3537.        }
  3538.        if (strtoupper($form_out) == "DB_FORMAT")
  3539.        {
  3540.            if (empty($dt_out))
  3541.            {
  3542.                $dt_out "null";
  3543.                return $dt_out;
  3544.            }
  3545.            $form_out "AAAA-MM-DD";
  3546.        }
  3547.        nm_conv_form_data($dt_out$form_in$form_out);
  3548.        return $dt_out;
  3549.    }
  3550.   function close_emb()
  3551.   {
  3552.       if ($this->Db)
  3553.       {
  3554.           $this->Db->Close(); 
  3555.       }
  3556.   }
  3557.    function SC_fast_search($field$arg_search$data_search)
  3558.    {
  3559.       if (empty($data_search)) 
  3560.       {
  3561.           $tmp_cmd "";
  3562.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'] = "";
  3563.           if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'])) 
  3564.           {
  3565.               $tmp_cmd $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig']; 
  3566.           }
  3567.           if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'])) 
  3568.           {
  3569.               if (!empty($tmp_cmd)) 
  3570.               {
  3571.                   $tmp_cmd .= " and (" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] . ")"
  3572.               }
  3573.               else
  3574.               {
  3575.                   $tmp_cmd " where (" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] . ")"
  3576.               }
  3577.           }
  3578.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] = $tmp_cmd;
  3579.           unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search']);
  3580.           return;
  3581.       }
  3582.       $comando "";
  3583.       if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($data_search))
  3584.       {
  3585.           $data_search NM_conv_charset($data_search$_SESSION['scriptcase']['charset'], "UTF-8");
  3586.       }
  3587.       $sv_data $data_search;
  3588.       if ($field == "SC_all_Cmp"
  3589.       {
  3590.           $this->SC_monta_condicao($comando"Proprietarios.idProprietario"$arg_search$data_search);
  3591.       }
  3592.       if ($field == "SC_all_Cmp"
  3593.       {
  3594.           $this->SC_monta_condicao($comando"Proprietarios.Nome"$arg_search$data_search);
  3595.       }
  3596.       if ($field == "SC_all_Cmp"
  3597.       {
  3598.           $this->SC_monta_condicao($comando"Proprietarios.Sexo"$arg_search$data_search);
  3599.       }
  3600.       if ($field == "SC_all_Cmp"
  3601.       {
  3602.           $this->SC_monta_condicao($comando"Proprietarios.Cpf"$arg_search$data_search);
  3603.       }
  3604.       if ($field == "SC_all_Cmp"
  3605.       {
  3606.           $this->SC_monta_condicao($comando"Proprietarios.Endereco"$arg_search$data_search);
  3607.       }
  3608.       if ($field == "SC_all_Cmp"
  3609.       {
  3610.           $this->SC_monta_condicao($comando"Proprietarios.Telefone"$arg_search$data_search);
  3611.       }
  3612.       if ($field == "SC_all_Cmp"
  3613.       {
  3614.           $this->SC_monta_condicao($comando"Proprietarios.Curso"$arg_search$data_search);
  3615.       }
  3616.       if ($field == "SC_all_Cmp"
  3617.       {
  3618.           $this->SC_monta_condicao($comando"Proprietarios.Cod"$arg_search$data_search);
  3619.       }
  3620.       if ($field == "SC_all_Cmp"
  3621.       {
  3622.           $this->SC_monta_condicao($comando"Proprietarios.SAT"$arg_search$data_search);
  3623.       }
  3624.       if ($field == "SC_all_Cmp"
  3625.       {
  3626.           $this->SC_monta_condicao($comando"Veiculos.idVeiculos"$arg_search$data_search);
  3627.       }
  3628.       if ($field == "SC_all_Cmp"
  3629.       {
  3630.           $this->SC_monta_condicao($comando"Veiculos.AnoModelo"$arg_search$data_search);
  3631.       }
  3632.       if ($field == "SC_all_Cmp"
  3633.       {
  3634.           $this->SC_monta_condicao($comando"Veiculos.Marca"$arg_search$data_search);
  3635.       }
  3636.       if ($field == "SC_all_Cmp"
  3637.       {
  3638.           $this->SC_monta_condicao($comando"Veiculos.Cor"$arg_search$data_search);
  3639.       }
  3640.       if ($field == "SC_all_Cmp"
  3641.       {
  3642.           $this->SC_monta_condicao($comando"Veiculos.Placa"$arg_search$data_search);
  3643.       }
  3644.       if ($field == "SC_all_Cmp"
  3645.       {
  3646.           $this->SC_monta_condicao($comando"Veiculos.idProprietario_fk"$arg_search$data_search);
  3647.       }
  3648.       if (empty($comando)) 
  3649.       {
  3650.           $comando " 1 <> 1 "
  3651.       }
  3652.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_fast'] = $comando;
  3653.       $tmp_cmd "";
  3654.       if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig'])) 
  3655.       {
  3656.           $tmp_cmd $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_orig']; 
  3657.       }
  3658.       if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'])) 
  3659.       {
  3660.           if (!empty($tmp_cmd)) 
  3661.           {
  3662.               $tmp_cmd .= " and (" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] . ")"
  3663.           }
  3664.           else
  3665.           {
  3666.               $tmp_cmd " where (" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq_filtro'] . ")"
  3667.           }
  3668.       }
  3669.       if (!empty($tmp_cmd)) 
  3670.       {
  3671.           $comando $tmp_cmd " and (" $comando ")"
  3672.       }
  3673.       else
  3674.       {
  3675.           $comando " where (" $comando ")"
  3676.       }
  3677.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['where_pesq'] = $comando;
  3678.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'][0] = $field;
  3679.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'][1] = $arg_search;
  3680.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['fast_search'][2] = $sv_data;
  3681.    }
  3682.    function SC_monta_condicao(&$comando$nome$condicao$campo$tp_campo="")
  3683.    {
  3684.       $nm_aspas   "'";
  3685.       $nm_aspas1  "'";
  3686.       $nm_numeric = array();
  3687.       $Nm_datas   = array();
  3688.       $nm_esp_postgres = array();
  3689.       $campo_join strtolower(str_replace(".""_"$nome));
  3690.       $nm_ini_lower "";
  3691.       $nm_fim_lower "";
  3692.       $nm_numeric[] = "proprietarios_idproprietario";$nm_numeric[] = "proprietarios_cpf";$nm_numeric[] = "veiculos_idveiculos";$nm_numeric[] = "veiculos_idproprietario_fk";
  3693.       if (in_array($campo_join$nm_numeric))
  3694.       {
  3695.          if ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['decimal_db'] == ".")
  3696.          {
  3697.              $nm_aspas  "";
  3698.              $nm_aspas1 "";
  3699.          }
  3700.          if (is_array($campo))
  3701.          {
  3702.              foreach ($campo as $Ind => $Cmp)
  3703.              {
  3704.                 if (!is_numeric($Cmp))
  3705.                 {
  3706.                     return;
  3707.                 }
  3708.                 if ($Cmp == "")
  3709.                 {
  3710.                     $campo[$Ind] = 0;
  3711.                 }
  3712.              }
  3713.          }
  3714.          else
  3715.          {
  3716.              if (!is_numeric($campo))
  3717.              {
  3718.                  return;
  3719.              }
  3720.              if ($campo == "")
  3721.              {
  3722.                 $campo 0;
  3723.              }
  3724.          }
  3725.       }
  3726.       if (in_array($campo_join$nm_numeric) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && (strtoupper($condicao) == "II" || strtoupper($condicao) == "QP" || strtoupper($condicao) == "NP"))
  3727.       {
  3728.           $nome      "CAST ($nome AS TEXT)";
  3729.           $nm_aspas  "'";
  3730.           $nm_aspas1 "'";
  3731.       }
  3732.       if (in_array($campo_join$nm_esp_postgres) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
  3733.       {
  3734.           $nome      "CAST ($nome AS TEXT)";
  3735.           $nm_aspas  "'";
  3736.           $nm_aspas1 "'";
  3737.       }
  3738.       if (in_array($campo_join$nm_numeric) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase) && (strtoupper($condicao) == "II" || strtoupper($condicao) == "QP" || strtoupper($condicao) == "NP"))
  3739.       {
  3740.           $nome      "CAST ($nome AS VARCHAR)";
  3741.           $nm_aspas  "'";
  3742.           $nm_aspas1 "'";
  3743.       }
  3744.       if (in_array($campo_join$nm_numeric) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_progress) && (strtoupper($condicao) == "II" || strtoupper($condicao) == "QP" || strtoupper($condicao) == "NP"))
  3745.       {
  3746.           $nome      "CAST ($nome AS VARCHAR(255))";
  3747.           $nm_aspas  "'";
  3748.           $nm_aspas1 "'";
  3749.       }
  3750.          $comando .= (!empty($comando) ? " or " "");
  3751.          if (is_array($campo))
  3752.          {
  3753.              $prep "";
  3754.              foreach ($campo as $Ind => $Cmp)
  3755.              {
  3756.                  $prep .= (!empty($prep)) ? "," "";
  3757.                  $Cmp   substr($this->Db->qstr($Cmp), 1, -1);
  3758.                  $prep .= $nm_aspas $Cmp $nm_aspas1;
  3759.              }
  3760.              $prep .= (empty($prep)) ? $nm_aspas $nm_aspas1 "";
  3761.              $comando .= $nm_ini_lower $nome $nm_fim_lower " in (" $prep ")";
  3762.              return;
  3763.          }
  3764.          $campo  substr($this->Db->qstr($campo), 1, -1);
  3765.          switch (strtoupper($condicao))
  3766.          {
  3767.             case "EQ":     // 
  3768.                $comando        .= $nm_ini_lower $nome $nm_fim_lower " = " $nm_aspas $campo $nm_aspas1;
  3769.             break;
  3770.             case "II":     // 
  3771.                $comando        .= $nm_ini_lower $nome $nm_fim_lower " like '" $campo "%'";
  3772.             break;
  3773.             case "QP":     // 
  3774.                $comando        .= $nm_ini_lower $nome $nm_fim_lower ." like '%" $campo "%'";
  3775.             break;
  3776.             case "NP":     // 
  3777.                $comando        .= $nm_ini_lower $nome $nm_fim_lower ." not like '%" $campo "%'";
  3778.             break;
  3779.             case "DF":     // 
  3780.                $comando        .= $nm_ini_lower $nome $nm_fim_lower " <> " $nm_aspas $campo $nm_aspas1;
  3781.             break;
  3782.             case "GT":     // 
  3783.                $comando        .= $nome > " $nm_aspas $campo $nm_aspas1;
  3784.             break;
  3785.             case "GE":     // 
  3786.                $comando        .= $nome >= " $nm_aspas $campo $nm_aspas1;
  3787.             break;
  3788.             case "LT":     // 
  3789.                $comando        .= $nome < " $nm_aspas $campo $nm_aspas1;
  3790.             break;
  3791.             case "LE":     // 
  3792.                $comando        .= $nome <= " $nm_aspas $campo $nm_aspas1;
  3793.             break;
  3794.          }
  3795.    }
  3796.    function SC_proc_grid_search($Parms)
  3797.    {
  3798.        $ix     0;
  3799.        $fields = array();
  3800.        $busca  = array();
  3801.        $this->Ini->sc_Include($this->Ini->path_lib_php "/nm_gp_limpa.php""F""nm_limpa_valor") ; 
  3802.        if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($Parms))
  3803.        {
  3804.            $Parms NM_conv_charset($Parms$_SESSION['scriptcase']['charset'], "UTF-8");
  3805.        }
  3806.        $tmp    explode("_FDYN_"$Parms);
  3807.        $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tmp_busca'] = array();
  3808.        foreach ($tmp as $cada_f)
  3809.        {
  3810.            $dats explode("_DYN_"$cada_f);
  3811.            if ($dats[1] == "del_grid_search_all")
  3812.            {
  3813.                foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'] as $ind => $dados)
  3814.                {
  3815.                    $this->proc_del_grid_search($indtrue);
  3816.                }
  3817.                unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq']);
  3818.                continue;
  3819.            }
  3820.            if ($dats[1] == "del_grid_search")
  3821.            {
  3822.                $this->proc_del_grid_search($dats[0], false);
  3823.                continue;
  3824.            }
  3825.            $fields[$ix]['field']  = $dats[0];
  3826.            $fields[$ix]['cond']   = $dats[1];
  3827.            $sep_bw                 explode("_VLS2_"$dats[2]);
  3828.            $fields[$ix]['vls'][0] = explode("_VLS_",  $sep_bw[0]);
  3829.            $fields[$ix]['vls'][1] = isset($sep_bw[1]) ? explode("_VLS_",  $sep_bw[1]) : "";
  3830.            $val_sv = array();
  3831.            foreach ($fields[$ix]['vls'] as $i => $dados)
  3832.            {
  3833.                if (is_array($dados))
  3834.                {
  3835.                    foreach ($dados as $ind => $str)
  3836.                    {
  3837.                        $str NM_charset_decode($str);
  3838.                        $tmp_pos strpos($str"##@@");
  3839.                        if ($tmp_pos === false)
  3840.                        {
  3841.                           $val_sv[$i][] = $str;
  3842.                        }
  3843.                        else
  3844.                        {
  3845.                          $val_sv[$i][] = substr($str0$tmp_pos);
  3846.                        }
  3847.                    }
  3848.                }
  3849.                else
  3850.                {
  3851.                    $dados NM_charset_decode($dados);
  3852.                    $tmp_pos strpos($dados"##@@");
  3853.                    if ($tmp_pos === false)
  3854.                    {
  3855.                       $val_sv[$i] = $dados;
  3856.                    }
  3857.                    else
  3858.                    {
  3859.                       $val_sv[$i] = substr($dados0$tmp_pos);
  3860.                    }
  3861.                }
  3862.            }
  3863.            if (!isset($busca[$dats[0]]))
  3864.            {
  3865.                $busca[$dats[0]] = $dats[1];
  3866.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tmp_busca'][$dats[0]] = (isset($fields[$ix]['vls'][0])) ? $fields[$ix]['vls'][0][0] : "";
  3867.                if (isset($fields[$ix]['vls'][1]))
  3868.                {
  3869.                    $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tmp_busca'][$dats[0] . '_input_2'] = $fields[$ix]['vls'][1][0];
  3870.                }
  3871.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tmp_busca'][$dats[0] . '_cond'] = $dats[1];
  3872.            }
  3873.            $ix++;
  3874.       }
  3875.       if ($_SESSION['scriptcase']['charset'] != "UTF-8")
  3876.       {
  3877.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tmp_busca'] = NM_conv_charset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tmp_busca'], "UTF-8"$_SESSION['scriptcase']['charset']);
  3878.       }
  3879.       foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['tmp_busca'] as $ind => $dados)
  3880.       {
  3881.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$ind] = $dados;
  3882.       }
  3883.       if (!$_SESSION['scriptcase']['proc_mobile']) 
  3884.       { 
  3885.           require_once($this->Ini->path_aplicacao "grid_new_pesq.class.php"); 
  3886.       } 
  3887.       else 
  3888.       { 
  3889.           require_once($this->Ini->path_aplicacao "grid_new_mobile_pesq.class.php"); 
  3890.       } 
  3891.       $this->pesq  = new grid_new_pesq();
  3892.       $this->prep_modulos("pesq");
  3893.       $this->pesq->NM_ajax_flag  true;
  3894.       $this->pesq->NM_ajax_opcao "ajax_grid_search";
  3895.       $this->pesq->monta_busca();
  3896.    }
  3897.    function proc_del_grid_search($cmp_del$del_all)
  3898.    {
  3899.       if (is_array($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$cmp_del]))
  3900.       {
  3901.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$cmp_del] = array();
  3902.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$cmp_del "_input_2"] = array();
  3903.       }
  3904.       else
  3905.       {
  3906.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$cmp_del] = "";
  3907.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$cmp_del "_input_2"] = "";
  3908.       }
  3909.       $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['campos_busca'][$cmp_del "_cond"] = "";
  3910.       unset($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['grid_pesq'][$cmp_del]);
  3911.    }
  3912.   function html_doc_word($nm_arquivo_doc_word$nmgp_password)
  3913.   {
  3914.       global $nm_url_saida;
  3915.       $Word_password "";
  3916.       if ($this->Ini->Export_zip || $Word_password != "")
  3917.       { 
  3918.           $Parm_pass  = ($Word_password != "") ? " -p" "";
  3919.           $Arq_zip $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file'];
  3920.           $Pos strrpos($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file'], ".");
  3921.           if ($Pos !== false) {
  3922.               $Arq_zip substr($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file'], 0$Pos);
  3923.           }
  3924.           $Arq_zip .= ".zip";
  3925.           $Arq_doc $nm_arquivo_doc_word;
  3926.           $Pos strrpos($nm_arquivo_doc_word".");
  3927.           if ($Pos !== false) {
  3928.               $Arq_doc substr($nm_arquivo_doc_word0$Pos);
  3929.           }
  3930.           $Arq_doc  .= ".zip";
  3931.           $Zip_f     = (FALSE !== strpos($Arq_zip' ')) ? " \"" $Arq_zip "\"" :  $Arq_zip;
  3932.           $Arq_input = (FALSE !== strpos($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file'], ' ')) ? " \"" $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file'] . "\"" :  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file'];
  3933.            if (is_file($Arq_zip)) {
  3934.                unlink($Arq_zip);
  3935.            }
  3936.            $str_zip "";
  3937.            if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  3938.            {
  3939.                chdir($this->Ini->path_third "/zip/windows");
  3940.                $str_zip "zip.exe " strtoupper($Parm_pass) . " -j " $Word_password " " $Zip_f " " $Arq_input;
  3941.            }
  3942.            elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  3943.            {
  3944.                 if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  3945.                 {
  3946.                     chdir($this->Ini->path_third "/zip/linux-i386/bin");
  3947.                 }
  3948.                 else
  3949.                 {
  3950.                     chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  3951.                 }
  3952.                $str_zip "./7za " $Parm_pass $Word_password " a " $Zip_f " " $Arq_input;
  3953.            }
  3954.            elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  3955.            {
  3956.                chdir($this->Ini->path_third "/zip/mac/bin");
  3957.                $str_zip "./7za " $Parm_pass $Word_password " a " $Zip_f " " $Arq_input;
  3958.            }
  3959.            if (!empty($str_zip)) {
  3960.                exec($str_zip);
  3961.            }
  3962.            // ----- ZIP log
  3963.            $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'w');
  3964.            if ($fp)
  3965.            {
  3966.                @fwrite($fp$str_zip "\r\n\r\n");
  3967.                @fclose($fp);
  3968.            }
  3969.            foreach ($this->Ini->Img_export_zip as $cada_img_zip)
  3970.            {
  3971.               $str_zip      "";
  3972.               $cada_img_zip '"' $cada_img_zip '"';
  3973.               if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  3974.               {
  3975.                   $str_zip "zip.exe " strtoupper($Parm_pass) . " -j -u " $Word_password " " $Zip_f " " $cada_img_zip;
  3976.               }
  3977.               elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  3978.               {
  3979.                   $str_zip "./7za " $Parm_pass $Word_password " a " $Zip_f " " $cada_img_zip;
  3980.               }
  3981.               elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  3982.               {
  3983.                   $str_zip "./7za " $Parm_pass $Word_password " a " $Zip_f " " $cada_img_zip;
  3984.               }
  3985.               if (!empty($str_zip)) {
  3986.                   exec($str_zip);
  3987.               }
  3988.               // ----- ZIP log
  3989.                $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'a');
  3990.               if ($fp)
  3991.               {
  3992.                   @fwrite($fp$str_zip "\r\n\r\n");
  3993.                   @fclose($fp);
  3994.               }
  3995.            }
  3996.            if (is_file($Arq_zip)) {
  3997.                unlink($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file']);
  3998.                $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file'] = $Arq_zip;
  3999.                $nm_arquivo_doc_word $Arq_doc;
  4000.           } 
  4001.       } 
  4002.       if ($this->Ini->sc_export_ajax)
  4003.       {
  4004.           $this->Arr_result['file_export']  = NM_charset_to_utf8($_SESSION['sc_session'][$this->Ini->sc_page]['grid_new']['word_file']);
  4005.           $this->Arr_result['title_export'] = NM_charset_to_utf8($nm_arquivo_doc_word);
  4006.           $Temp ob_get_clean();
  4007.           if ($Temp !== false && trim($Temp) != "")
  4008.           {
  4009.               $this->Arr_result['htmOutput'] = NM_charset_to_utf8($Temp);
  4010.           }
  4011.           $oJson = new Services_JSON();
  4012.           echo $oJson->encode($this->Arr_result);
  4013.           exit;
  4014.       }
  4015.       if (strpos(" " $this->Ini->SC_module_export"grid") !== false)
  4016.       {
  4017.           $path_doc_md5 md5($this->Ini->path_imag_temp $nm_arquivo_doc_word);
  4018.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp $nm_arquivo_doc_word;
  4019.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = substr($nm_arquivo_doc_word1);
  4020.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  4021.           $this->pb = new scProgressBar();
  4022.           $this->pb->setRoot($this->Ini->root);
  4023.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  4024.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  4025.           $this->pb->initialize();
  4026.           $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  4027.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  4028.               $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  4029.           }
  4030.           $this->pb->setProgressbarMessage($Mens_bar);
  4031.           $this->pb->setDownloadLink($this->Ini->path_imag_temp $nm_arquivo_doc_word);
  4032.           $this->pb->setDownloadMd5($path_doc_md5);
  4033.           $this->pb->setReturnUrl("./");
  4034.           $this->pb->setReturnOption($this->ret_word);
  4035.           $this->pb->completed();
  4036.           return;
  4037.       }
  4038. ?>
  4039. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  4040.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  4041. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  4042. <HEAD>
  4043.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: Doc</TITLE>
  4044.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  4045. <?php
  4046. if ($_SESSION['scriptcase']['proc_mobile'])
  4047. {
  4048. ?>
  4049.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  4050. <?php
  4051. }
  4052. $path_doc_md5 md5($this->Ini->path_imag_temp $nm_arquivo_doc_word);
  4053. $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp $nm_arquivo_doc_word;
  4054. $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = substr($nm_arquivo_doc_word1);
  4055. ?>
  4056.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  4057.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  4058.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  4059.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  4060.  <META http-equiv="Pragma" content="no-cache"/>
  4061.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  4062.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  4063.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  4064.  <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/font-awesome/css/all.min.css" type="text/css" media="screen" />
  4065.  <?php
  4066.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  4067.  {
  4068.  ?>
  4069.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  4070.  <?php
  4071.  }
  4072.  ?>
  4073.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  4074. </HEAD>
  4075. <BODY class="scExportPage">
  4076. <?php echo $this->Ini->Ajax_result_set ?>
  4077. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  4078.  <table class="scExportTable" align="center">
  4079.   <tr>
  4080.    <td class="scExportTitle" style="height: 25px">WORD</td>
  4081.   </tr>
  4082.   <tr>
  4083.    <td class="scExportLine" style="width: 100%">
  4084.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  4085.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  4086.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  4087.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4088.  ?>
  4089.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4090.  ?>
  4091.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4092.  ?>
  4093.     </td></tr></table>
  4094.    </td>
  4095.   </tr>
  4096.  </table>
  4097. </td></tr></table>
  4098. <form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp $nm_arquivo_doc_word ?>" target="_blank" style="display: none"> 
  4099. </form>
  4100. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  4101. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  4102. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  4103. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  4104. </form>
  4105. <FORM name="F0" method=post action="./"> 
  4106. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  4107. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  4108. <INPUT type="hidden" name="nmgp_opcao" value="<?php echo NM_encode_input($this->ret_word?>"> 
  4109. </FORM> 
  4110. </BODY>
  4111. </HTML>
  4112. <?php
  4113.   }
  4114.   function html_export_print($nm_arquivo_html$nmgp_password)
  4115.   {
  4116.       global $nm_url_saida;
  4117.       $Html_password "";
  4118.           $Arq_base  $this->Ini->root $this->Ini->path_imag_temp $nm_arquivo_html;
  4119.           $Parm_pass = ($Html_password != "") ? " -p" "";
  4120.           $Arq_zip   $Arq_base;
  4121.           $Pos strrpos($Arq_base".");
  4122.           if ($Pos !== false) {
  4123.               $Arq_zip substr($Arq_base0$Pos);
  4124.           }
  4125.           $Arq_zip .= ".zip";
  4126.           $Arq_htm  $nm_arquivo_html;
  4127.           $Pos strrpos($nm_arquivo_html".");
  4128.           if ($Pos !== false) {
  4129.               $Arq_htm substr($nm_arquivo_html0$Pos);
  4130.           }
  4131.           $Arq_htm  .= ".zip";
  4132.           $Zip_f     = (FALSE !== strpos($Arq_zip' ')) ? " \"" $Arq_zip "\"" :  $Arq_zip;
  4133.           $Arq_input = (FALSE !== strpos($Arq_base' ')) ? " \"" $Arq_base "\"" :  $Arq_base;
  4134.            if (is_file($Arq_zip)) {
  4135.                unlink($Arq_zip);
  4136.            }
  4137.            $str_zip "";
  4138.            if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  4139.            {
  4140.                chdir($this->Ini->path_third "/zip/windows");
  4141.                $str_zip "zip.exe " strtoupper($Parm_pass) . " -j " $Html_password " " $Zip_f " " $Arq_input;
  4142.            }
  4143.            elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  4144.            {
  4145.                 if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  4146.                 {
  4147.                     chdir($this->Ini->path_third "/zip/linux-i386/bin");
  4148.                 }
  4149.                 else
  4150.                 {
  4151.                     chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  4152.                 }
  4153.                $str_zip "./7za " $Parm_pass $Html_password " a " $Zip_f " " $Arq_input;
  4154.            }
  4155.            elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  4156.            {
  4157.                chdir($this->Ini->path_third "/zip/mac/bin");
  4158.                $str_zip "./7za " $Parm_pass $Html_password " a " $Zip_f " " $Arq_input;
  4159.            }
  4160.            if (!empty($str_zip)) {
  4161.                exec($str_zip);
  4162.            }
  4163.            // ----- ZIP log
  4164.            $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'w');
  4165.            if ($fp)
  4166.            {
  4167.                @fwrite($fp$str_zip "\r\n\r\n");
  4168.                @fclose($fp);
  4169.            }
  4170.            $this->Ini->Img_export_zip[] = $this->Ini->root $this->Ini->path_imag_cab "/" $this->Ini->Label_sort;
  4171.            $this->Ini->Img_export_zip[] = $this->Ini->root $this->Ini->path_imag_cab "/" $this->Ini->Label_sort_desc;
  4172.            $this->Ini->Img_export_zip[] = $this->Ini->root $this->Ini->path_imag_cab "/" $this->Ini->Label_sort_asc;
  4173.            $this->Ini->Img_export_zip[] = $this->Ini->root $this->Ini->path_imag_cab "/" $this->Ini->Label_summary_sort_desc;
  4174.            $this->Ini->Img_export_zip[] = $this->Ini->root $this->Ini->path_imag_cab "/" $this->Ini->Label_summary_sort_asc;
  4175.            foreach ($this->Ini->Img_export_zip as $cada_img_zip)
  4176.            {
  4177.                $str_zip      "";
  4178.               $cada_img_zip '"' $cada_img_zip '"';
  4179.                if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  4180.                {
  4181.                    $str_zip "zip.exe " strtoupper($Parm_pass) . " -j -u " $Html_password " " $Zip_f " " $cada_img_zip;
  4182.                }
  4183.                elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  4184.                {
  4185.                    $str_zip "./7za " $Parm_pass $Html_password " a " $Zip_f " " $cada_img_zip;
  4186.                }
  4187.                elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  4188.                {
  4189.                    $str_zip "./7za " $Parm_pass $Html_password " a " $Zip_f " " $cada_img_zip;
  4190.                }
  4191.                if (!empty($str_zip)) {
  4192.                    exec($str_zip);
  4193.                }
  4194.                // ----- ZIP log
  4195.                $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'a');
  4196.                if ($fp)
  4197.                {
  4198.                    @fwrite($fp$str_zip "\r\n\r\n");
  4199.                    @fclose($fp);
  4200.                }
  4201.            }
  4202.            if (is_file($Arq_zip)) {
  4203.                unlink($Arq_base);
  4204.                $nm_arquivo_html $Arq_htm;
  4205.            } 
  4206.           $path_doc_md5 md5($this->Ini->path_imag_temp $nm_arquivo_html);
  4207.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp $nm_arquivo_html;
  4208.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = substr($nm_arquivo_html1);
  4209.           require_once($this->Ini->path_lib_php "/sc_progress_bar.php");
  4210.           $this->pb = new scProgressBar();
  4211.           $this->pb->setRoot($this->Ini->root);
  4212.           $this->pb->setDir($_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/");
  4213.           $this->pb->setProgressbarMd5($_GET['pbmd5']);
  4214.           $this->pb->initialize();
  4215.           $Mens_bar $this->Ini->Nm_lang['lang_othr_file_msge'];
  4216.           if ($_SESSION['scriptcase']['charset'] != "UTF-8") {
  4217.               $Mens_bar sc_convert_encoding($Mens_bar"UTF-8"$_SESSION['scriptcase']['charset']);
  4218.           }
  4219.           $this->pb->setProgressbarMessage($Mens_bar);
  4220.           $this->pb->setDownloadLink($this->Ini->path_imag_temp $nm_arquivo_html);
  4221.           $this->pb->setDownloadMd5($path_doc_md5);
  4222.           $this->pb->setReturnUrl("./");
  4223.           $this->pb->setReturnOption($this->ret_print);
  4224.           $this->pb->completed();
  4225.           return;
  4226.   }
  4227.   function html_pdf_detalhe($nm_arquivo_pdf_det)
  4228.   {
  4229. ?>
  4230. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  4231.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  4232. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  4233. <HEAD>
  4234.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: Doc</TITLE>
  4235.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  4236. <?php
  4237. if ($_SESSION['scriptcase']['proc_mobile'])
  4238. {
  4239. ?>
  4240.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  4241. <?php
  4242. }
  4243.  $path_doc_md5 md5($nm_arquivo_pdf_det);
  4244.  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $nm_arquivo_pdf_det;
  4245.  $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = "grid_new_det.pdf";
  4246. ?>
  4247.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  4248.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  4249.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  4250.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  4251.  <META http-equiv="Pragma" content="no-cache"/>
  4252.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  4253.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  4254.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  4255.  <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/font-awesome/css/all.min.css" type="text/css" media="screen" />
  4256.  <?php
  4257.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  4258.  {
  4259.  ?>
  4260.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  4261.  <?php
  4262.  }
  4263.  ?>
  4264.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  4265. </HEAD>
  4266. <BODY class="scExportPage">
  4267. <?php echo $this->Ini->Ajax_result_set ?>
  4268. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  4269.  <table class="scExportTable" align="center">
  4270.   <tr>
  4271.    <td class="scExportTitle" style="height: 25px">PDF</td>
  4272.   </tr>
  4273.   <tr>
  4274.    <td class="scExportLine" style="width: 100%">
  4275.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  4276.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  4277.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  4278.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4279.  ?>
  4280.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4281.  ?>
  4282.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4283.  ?>
  4284.     </td></tr></table>
  4285.    </td>
  4286.   </tr>
  4287.  </table>
  4288. </td></tr></table>
  4289. <form name="Fview" method="get" action="<?php echo  NM_encode_input($nm_arquivo_pdf_det?>" target="_blank" style="display: none"> 
  4290. </form>
  4291. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  4292. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  4293. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  4294. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  4295. </form>
  4296. <FORM name="F0" method=post action="./"> 
  4297. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  4298. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  4299. <INPUT type="hidden" name="nmgp_opcao" value="detalhe"> 
  4300. </FORM> 
  4301. </BODY>
  4302. </HTML>
  4303. <?php
  4304.   }
  4305.   function det_export_print($nm_arquivo_html$nmgp_password)
  4306.   {
  4307.       global $nm_url_saida;
  4308.       $Html_password "";
  4309.           $Arq_base  $this->Ini->root $this->Ini->path_imag_temp $nm_arquivo_html;
  4310.           $Parm_pass = ($Html_password != "") ? " -p" "";
  4311.           $Arq_zip   $Arq_base;
  4312.           $Pos strrpos($Arq_base".");
  4313.           if ($Pos !== false) {
  4314.               $Arq_zip substr($Arq_base0$Pos);
  4315.           }
  4316.           $Arq_zip .= ".zip";
  4317.           $Arq_htm  $nm_arquivo_html;
  4318.           $Pos strrpos($nm_arquivo_html".");
  4319.           if ($Pos !== false) {
  4320.               $Arq_htm substr($nm_arquivo_html0$Pos);
  4321.           }
  4322.           $Arq_htm  .= ".zip";
  4323.           $Zip_f     = (FALSE !== strpos($Arq_zip' ')) ? " \"" $Arq_zip "\"" :  $Arq_zip;
  4324.           $Arq_input = (FALSE !== strpos($Arq_base' ')) ? " \"" $Arq_base "\"" :  $Arq_base;
  4325.            if (is_file($Arq_zip)) {
  4326.                unlink($Arq_zip);
  4327.            }
  4328.            $str_zip "";
  4329.            if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  4330.            {
  4331.                chdir($this->Ini->path_third "/zip/windows");
  4332.                $str_zip "zip.exe " strtoupper($Parm_pass) . " -j " $Html_password " " $Zip_f " " $Arq_input;
  4333.            }
  4334.            elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  4335.            {
  4336.                 if (FALSE !== strpos(strtolower(php_uname()), 'i686')) 
  4337.                 {
  4338.                     chdir($this->Ini->path_third "/zip/linux-i386/bin");
  4339.                 }
  4340.                 else
  4341.                 {
  4342.                     chdir($this->Ini->path_third "/zip/linux-amd64/bin");
  4343.                 }
  4344.                $str_zip "./7za " $Parm_pass $Html_password " a " $Zip_f " " $Arq_input;
  4345.            }
  4346.            elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  4347.            {
  4348.                chdir($this->Ini->path_third "/zip/mac/bin");
  4349.                $str_zip "./7za " $Parm_pass $Html_password " a " $Zip_f " " $Arq_input;
  4350.            }
  4351.            if (!empty($str_zip)) {
  4352.                exec($str_zip);
  4353.            }
  4354.            // ----- ZIP log
  4355.            $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'w');
  4356.            if ($fp)
  4357.            {
  4358.                @fwrite($fp$str_zip "\r\n\r\n");
  4359.                @fclose($fp);
  4360.            }
  4361.            foreach ($this->Ini->Img_export_zip as $cada_img_zip)
  4362.            {
  4363.                $str_zip      "";
  4364.               $cada_img_zip '"' $cada_img_zip '"';
  4365.                if (FALSE !== strpos(strtolower(php_uname()), 'windows')) 
  4366.                {
  4367.                    $str_zip "zip.exe " strtoupper($Parm_pass) . " -j -u " $Html_password " " $Zip_f " " $cada_img_zip;
  4368.                }
  4369.                elseif (FALSE !== strpos(strtolower(php_uname()), 'linux')) 
  4370.                {
  4371.                    $str_zip "./7za " $Parm_pass $Html_password " a " $Zip_f " " $cada_img_zip;
  4372.                }
  4373.                elseif (FALSE !== strpos(strtolower(php_uname()), 'darwin'))
  4374.                {
  4375.                    $str_zip "./7za " $Parm_pass $Html_password " a " $Zip_f " " $cada_img_zip;
  4376.                }
  4377.                if (!empty($str_zip)) {
  4378.                    exec($str_zip);
  4379.                }
  4380.                // ----- ZIP log
  4381.                $fp = @fopen(trim(str_replace(array(".zip",'"'), array(".log",""), $Zip_f)), 'a');
  4382.                if ($fp)
  4383.                {
  4384.                    @fwrite($fp$str_zip "\r\n\r\n");
  4385.                    @fclose($fp);
  4386.                }
  4387.            }
  4388.            if (is_file($Arq_zip)) {
  4389.                unlink($Arq_base);
  4390.                $nm_arquivo_html $Arq_htm;
  4391.            } 
  4392.           $path_doc_md5 md5($this->Ini->path_imag_temp $nm_arquivo_html);
  4393.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][0] = $this->Ini->path_imag_temp $nm_arquivo_html;
  4394.           $_SESSION['sc_session'][$this->Ini->sc_page]['grid_new'][$path_doc_md5][1] = substr($nm_arquivo_html1);
  4395. ?>
  4396. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  4397.             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
  4398. <HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'?>>
  4399. <HEAD>
  4400.  <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_title'?>  :: Doc</TITLE>
  4401.  <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'?>" />
  4402. <?php
  4403. if ($_SESSION['scriptcase']['proc_mobile'])
  4404. {
  4405. ?>
  4406.    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  4407. <?php
  4408. }
  4409. ?>
  4410.  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  4411.  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  4412.  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  4413.  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  4414.  <META http-equiv="Pragma" content="no-cache"/>
  4415.  <link rel="shortcut icon" href="../_lib/img/scriptcase__NM__ico__NM__favicon.ico">
  4416.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  4417.   <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'?>.css" /> 
  4418.  <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/font-awesome/css/all.min.css" type="text/css" media="screen" />
  4419.  <?php
  4420.  if(isset($this->Ini->str_google_fonts) && !empty($this->Ini->str_google_fonts))
  4421.  {
  4422.  ?>
  4423.     <link rel="stylesheet" type="text/css" href="<?php echo $this->Ini->str_google_fonts ?>" />
  4424.  <?php
  4425.  }
  4426.  ?>
  4427.   <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
  4428. </HEAD>
  4429. <BODY class="scExportPage">
  4430. <?php echo $this->Ini->Ajax_result_set ?>
  4431. <table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
  4432.  <table class="scExportTable" align="center">
  4433.   <tr>
  4434.    <td class="scExportTitle" style="height: 25px"><?php echo $this->Ini->Nm_lang['lang_othr_detl_titl'?></td>
  4435.   </tr>
  4436.   <tr>
  4437.    <td class="scExportLine" style="width: 100%">
  4438.     <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
  4439.     <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'?>
  4440.     </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
  4441.      <?php echo nmButtonOutput($this->arr_buttons"bexportview""document.Fview.submit()""document.Fview.submit()""idBtnView"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4442.  ?>
  4443.      <?php echo nmButtonOutput($this->arr_buttons"bdownload""document.Fdown.submit()""document.Fdown.submit()""idBtnDown"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4444.  ?>
  4445.      <?php echo nmButtonOutput($this->arr_buttons"bvoltar""document.F0.submit()""document.F0.submit()""idBtnBack"""""""""""""$this->Ini->path_botoes"""""""""""only_text""text_right""""""""""""""");
  4446.  ?>
  4447.     </td></tr></table>
  4448.    </td>
  4449.   </tr>
  4450.  </table>
  4451. </td></tr></table>
  4452. <form name="Fview" method="get" action="<?php echo  $this->Ini->path_imag_temp $nm_arquivo_html ?>" target="_blank" style="display: none"> 
  4453. </form>
  4454. <form name="Fdown" method="get" action="grid_new_download.php" target="_blank" style="display: none"> 
  4455. <input type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  4456. <input type="hidden" name="nm_tit_doc" value="grid_new"> 
  4457. <input type="hidden" name="nm_name_doc" value="<?php echo $path_doc_md5 ?>"> 
  4458. </form>
  4459. <FORM name="F0" method=post action="./"> 
  4460. <INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
  4461. <INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
  4462. <INPUT type="hidden" name="nmgp_opcao" value="detalhe"> 
  4463. </FORM> 
  4464. </BODY>
  4465. </HTML>
  4466. <?php
  4467.   }

  4468. // 
  4469. //======= =========================
  4470.    if (isset($_SESSION['scriptcase']['grid_new']['sc_process_barr'])) {
  4471.        return;
  4472.    }
  4473.    if (!function_exists("NM_is_utf8"))
  4474.    {
  4475.        include_once("../_lib/lib/php/nm_utf8.php");
  4476.    }
  4477.    if (!function_exists("SC_dir_app_ini"))
  4478.    {
  4479.        include_once("../_lib/lib/php/nm_ctrl_app_name.php");
  4480.    }
  4481.    SC_dir_app_ini('Projeto7');
  4482.    $_SESSION['scriptcase']['grid_new']['contr_erro'] = 'off';
  4483.    $sc_conv_var = array();
  4484.    $Sc_lig_md5 false;
  4485.    $Sem_Session = (!isset($_SESSION['sc_session'])) ? true false;
  4486.    $_SESSION['scriptcase']['sem_session'] = false;
  4487.    if (!empty($_POST))
  4488.    {
  4489.        if (isset($_POST['parm']))
  4490.        {
  4491.            $_POST['parm'] = str_replace("__NM_PLUS__""+"$_POST['parm']);
  4492.            $_POST['parm'] = str_replace("__NM_AMP__""&"$_POST['parm']);
  4493.            $_POST['parm'] = str_replace("__NM_PRC__""%"$_POST['parm']);
  4494.        }
  4495.        foreach ($_POST as $nmgp_var => $nmgp_val)
  4496.        {
  4497.             $nmgp_val str_replace("__NM_PLUS__""+"$nmgp_val);
  4498.             $nmgp_val str_replace("__NM_AMP__""&"$nmgp_val);
  4499.             $nmgp_val str_replace("__NM_PRC__""%"$nmgp_val);
  4500.             if (substr($nmgp_var011) == "SC_glo_par_")
  4501.             {
  4502.                 $nmgp_var substr($nmgp_var11);
  4503.                 $nmgp_val $_SESSION[$nmgp_val];
  4504.             }
  4505.              if ($nmgp_var == "nmgp_parms" && substr($nmgp_val08) == "@SC_par@")
  4506.              {
  4507.                  $SC_Ind_Val explode("@SC_par@"$nmgp_val);
  4508.                  if (count($SC_Ind_Val) == && isset($_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['Lig_Md5'][$SC_Ind_Val[3]]))
  4509.                  {
  4510.                      $nmgp_val $_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['Lig_Md5'][$SC_Ind_Val[3]];
  4511.                      $Sc_lig_md5 true;
  4512.                  }
  4513.                  else
  4514.                  {
  4515.                      $_SESSION['sc_session']['SC_parm_violation'] = true;
  4516.                  }
  4517.              }
  4518.              if ($nmgp_var == "nmgp_parms_where" && substr($nmgp_val08) == "@SC_par@")
  4519.              {
  4520.                  $SC_Ind_Val explode("@SC_par@"$nmgp_val);
  4521.                  if (count($SC_Ind_Val) == && isset($_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['LigR_Md5'][$SC_Ind_Val[3]]))
  4522.                  {
  4523.                      $nmgp_val $_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['LigR_Md5'][$SC_Ind_Val[3]];
  4524.                  }
  4525.                  else
  4526.                  {
  4527.                      $_SESSION['sc_session']['SC_parm_violation'] = true;
  4528.                  }
  4529.              }
  4530.             if (isset($sc_conv_var[$nmgp_var]))
  4531.             {
  4532.                 $nmgp_var $sc_conv_var[$nmgp_var];
  4533.             }
  4534.             elseif (isset($sc_conv_var[strtolower($nmgp_var)]))
  4535.             {
  4536.                 $nmgp_var $sc_conv_var[strtolower($nmgp_var)];
  4537.             }
  4538.             nm_limpa_str_grid_new($nmgp_val);
  4539.             $nmgp_val NM_decode_input($nmgp_val);
  4540.             nm_protect_num_grid_new($nmgp_var$nmgp_val);
  4541.             $$nmgp_var $nmgp_val;
  4542.        }
  4543.    }
  4544.    if (!empty($_GET))
  4545.    {
  4546.        if (isset($_GET['parm']))
  4547.        {
  4548.            $_GET['parm'] = str_replace("__NM_PLUS__""+"$_GET['parm']);
  4549.            $_GET['parm'] = str_replace("__NM_AMP__""&"$_GET['parm']);
  4550.            $_GET['parm'] = str_replace("__NM_PRC__""%"$_GET['parm']);
  4551.        }
  4552.        foreach ($_GET as $nmgp_var => $nmgp_val)
  4553.        {
  4554.             $nmgp_val str_replace("__NM_PLUS__""+"$nmgp_val);
  4555.             $nmgp_val str_replace("__NM_AMP__""&"$nmgp_val);
  4556.             $nmgp_val str_replace("__NM_PRC__""%"$nmgp_val);
  4557.             if (substr($nmgp_var011) == "SC_glo_par_")
  4558.             {
  4559.                 $nmgp_var substr($nmgp_var11);
  4560.                 $nmgp_val $_SESSION[$nmgp_val];
  4561.             }
  4562.              if ($nmgp_var == "nmgp_parms" && substr($nmgp_val08) == "@SC_par@")
  4563.              {
  4564.                  $SC_Ind_Val explode("@SC_par@"$nmgp_val);
  4565.                  if (count($SC_Ind_Val) == && isset($_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['Lig_Md5'][$SC_Ind_Val[3]]))
  4566.                  {
  4567.                      $nmgp_val $_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['Lig_Md5'][$SC_Ind_Val[3]];
  4568.                      $Sc_lig_md5 true;
  4569.                  }
  4570.                  else
  4571.                  {
  4572.                      $_SESSION['sc_session']['SC_parm_violation'] = true;
  4573.                  }
  4574.              }
  4575.              if ($nmgp_var == "nmgp_parms_where" && substr($nmgp_val08) == "@SC_par@")
  4576.              {
  4577.                  $SC_Ind_Val explode("@SC_par@"$nmgp_val);
  4578.                  if (count($SC_Ind_Val) == && isset($_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['LigR_Md5'][$SC_Ind_Val[3]]))
  4579.                  {
  4580.                      $nmgp_val $_SESSION['sc_session'][$SC_Ind_Val[1]][$SC_Ind_Val[2]]['LigR_Md5'][$SC_Ind_Val[3]];
  4581.                  }
  4582.                  else
  4583.                  {
  4584.                      $_SESSION['sc_session']['SC_parm_violation'] = true;
  4585.                  }
  4586.              }
  4587.             if (isset($sc_conv_var[$nmgp_var]))
  4588.             {
  4589.                 $nmgp_var $sc_conv_var[$nmgp_var];
  4590.             }
  4591.             elseif (isset($sc_conv_var[strtolower($nmgp_var)]))
  4592.             {
  4593.                 $nmgp_var $sc_conv_var[strtolower($nmgp_var)];
  4594.             }
  4595.             nm_limpa_str_grid_new($nmgp_val);
  4596.             $nmgp_val NM_decode_input($nmgp_val);
  4597.             nm_protect_num_grid_new($nmgp_var$nmgp_val);
  4598.             $$nmgp_var $nmgp_val;
  4599.        }
  4600.    }
  4601.    if (!isset($_SERVER['HTTP_REFERER']) && !isset($nmgp_parms) && !isset($script_case_init) && !isset($script_case_session) && !isset($nmgp_start))
  4602.    {
  4603.        $Sem_Session false;
  4604.    }
  4605.    $NM_dir_atual getcwd();
  4606.    if (empty($NM_dir_atual)) {
  4607.        $str_path_sys  = (isset($_SERVER['SCRIPT_FILENAME'])) ? $_SERVER['SCRIPT_FILENAME'] : $_SERVER['ORIG_PATH_TRANSLATED'];
  4608.        $str_path_sys  str_replace("\\"'/'$str_path_sys);
  4609.    }
  4610.    else {
  4611.        $sc_nm_arquivo explode("/"$_SERVER['PHP_SELF']);
  4612.        $str_path_sys  str_replace("\\""/"getcwd()) . "/" $sc_nm_arquivo[count($sc_nm_arquivo)-1];
  4613.    }
  4614.    $str_path_web    $_SERVER['PHP_SELF'];
  4615.    $str_path_web    str_replace("\\"'/'$str_path_web);
  4616.    $str_path_web    str_replace('//''/'$str_path_web);
  4617.    $path_aplicacao  substr($str_path_web0strrpos($str_path_web'/'));
  4618.    $path_aplicacao  substr($path_aplicacao0strrpos($path_aplicacao'/'));
  4619.    $root            substr($str_path_sys0, -strlen($str_path_web));
  4620.    if ($Sem_Session && (!isset($nmgp_start) || $nmgp_start != "SC")) {
  4621.        if (isset($_COOKIE['sc_apl_default_Projeto7'])) {
  4622.            $apl_def explode(","$_COOKIE['sc_apl_default_Projeto7']);
  4623.        }
  4624.        elseif (is_file($root $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/sc_apl_default_Projeto7.txt")) {
  4625.            $apl_def explode(","file_get_contents($root $_SESSION['scriptcase']['grid_new']['glo_nm_path_imag_temp'] . "/sc_apl_default_Projeto7.txt"));
  4626.        }
  4627.        if (isset($apl_def)) {
  4628.            if ($apl_def[0] != "grid_new") {
  4629.                $_SESSION['scriptcase']['sem_session'] = true;
  4630.                if (strtolower(substr($apl_def[0], 7)) == "http://" || strtolower(substr($apl_def[0], 8)) == "https://" || substr($apl_def[0], 2) == "..") {
  4631.                    $_SESSION['scriptcase']['grid_new']['session_timeout']['redir'] = $apl_def[0];
  4632.                }
  4633.                else {
  4634.                    $_SESSION['scriptcase']['grid_new']['session_timeout']['redir'] = $path_aplicacao "/" SC_dir_app_name($apl_def[0]) . "/index.php";
  4635.                }
  4636.                $Redir_tp = (isset($apl_def[1])) ? trim(strtoupper($apl_def[1])) : "";
  4637.                $_SESSION['scriptcase']['grid_new']['session_timeout']['redir_tp'] = $Redir_tp;
  4638.            }
  4639.            if (isset($_COOKIE['sc_actual_lang_Projeto7'])) {
  4640.                $_SESSION['scriptcase']['grid_new']['session_timeout']['lang'] = $_COOKIE['sc_actual_lang_Projeto7'];
  4641.            }
  4642.        }
  4643.    }
  4644.    if (isset($SC_lig_apl_orig) && !$Sc_lig_md5 && (!isset($nmgp_parms) || ($nmgp_parms != "SC_null" && substr($nmgp_parms08) != "OrScLink")))
  4645.    {
  4646.        $_SESSION['sc_session']['SC_parm_violation'] = true;
  4647.    }
  4648.    if (isset($nmgp_parms) && $nmgp_parms == "SC_null")
  4649.    {
  4650.        $nmgp_parms "";
  4651.    }
  4652.    if (!empty($glo_perfil))  
  4653.    { 
  4654.       $_SESSION['scriptcase']['glo_perfil'] = $glo_perfil;
  4655.    }   
  4656.    if (isset($glo_servidor)) 
  4657.    {
  4658.        $_SESSION['scriptcase']['glo_servidor'] = $glo_servidor;
  4659.    }
  4660.    if (isset($glo_banco)) 
  4661.    {
  4662.        $_SESSION['scriptcase']['glo_banco'] = $glo_banco;
  4663.    }
  4664.    if (isset($glo_tpbanco)) 
  4665.    {
  4666.        $_SESSION['scriptcase']['glo_tpbanco'] = $glo_tpbanco;
  4667.    }
  4668.    if (isset($glo_usuario)) 
  4669.    {
  4670.        $_SESSION['scriptcase']['glo_usuario'] = $glo_usuario;
  4671.    }
  4672.    if (isset($glo_senha)) 
  4673.    {
  4674.        $_SESSION['scriptcase']['glo_senha'] = $glo_senha;
  4675.    }
  4676.    if (isset($glo_senha_protect)) 
  4677.    {
  4678.        $_SESSION['scriptcase']['glo_senha_protect'] = $glo_senha_protect;
  4679.    }
  4680.    if (isset($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_pai']))
  4681.    {
  4682.        $apl_pai $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_pai'];
  4683.        if (isset($_SESSION['sc_session'][$script_case_init][$apl_pai]['embutida_filho']))
  4684.        {
  4685.            foreach ($_SESSION['sc_session'][$script_case_init][$apl_pai]['embutida_filho'] as $init_filho)
  4686.            {
  4687.                if (isset($_SESSION['sc_session'][$init_filho]['grid_new']['master_pai']) && $_SESSION['sc_session'][$init_filho]['grid_new']['master_pai'] == $script_case_init)
  4688.                {
  4689.                    $script_case_init $init_filho;
  4690.                    break;
  4691.                }
  4692.            }
  4693.        }
  4694.    }
  4695.    if (isset($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form']) && $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form'] && !isset($_SESSION['sc_session'][$script_case_init]['grid_new']['master_pai']))
  4696.    {
  4697.        $SC_init_ant $script_case_init;
  4698.        $script_case_init rand(210000);
  4699.        if (isset($_SESSION['sc_session'][$SC_init_ant]['grid_new']['embutida_pai']))
  4700.        {
  4701.            $_SESSION['sc_session'][$SC_init_ant][$_SESSION['sc_session'][$SC_init_ant]['grid_new']['embutida_pai']]['embutida_filho'][] = $script_case_init;
  4702.        }
  4703.        $_SESSION['sc_session'][$script_case_init]['grid_new']['master_pai'] = $SC_init_ant;
  4704.    }
  4705.    if (isset($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['grid_new']['master_pai']))
  4706.    {
  4707.        $SC_init_ant $_SESSION['sc_session'][$script_case_init]['grid_new']['master_pai'];
  4708.        if (!isset($_SESSION['sc_session'][$SC_init_ant]['grid_new']['embutida_form_parms']))
  4709.        {
  4710.            $_SESSION['sc_session'][$SC_init_ant]['grid_new']['embutida_form_parms'] = "";
  4711.        }
  4712.        $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_parms'] = $_SESSION['sc_session'][$SC_init_ant]['grid_new']['embutida_form_parms'];
  4713.        $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form'] = true;
  4714.        $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_full'] = (isset($_SESSION['sc_session'][$SC_init_ant]['grid_new']['embutida_form_full'])) ? $_SESSION['sc_session'][$SC_init_ant]['grid_new']['embutida_form_full'] : false;
  4715.        $_SESSION['sc_session'][$script_case_init]['grid_new']['reg_start'] = "";
  4716.        $_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] = "inicio";
  4717.        unset($_SESSION['sc_session'][$SC_init_ant]['grid_new']['embutida_form']);
  4718.        unset($_SESSION['sc_session'][$SC_init_ant]['grid_new']['embutida_form_parms']);
  4719.    }
  4720.    if (isset($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_parms'])) 
  4721.    {
  4722.        if (!empty($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_parms'])) 
  4723.        {
  4724.            $nmgp_parms $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_parms'];
  4725.            $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_parms'] = "";
  4726.        }
  4727.    }
  4728.    elseif (isset($script_case_init))
  4729.    {
  4730.        unset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form']);
  4731.        unset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_full']);
  4732.        unset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_parms']);
  4733.    }
  4734.    if (!isset($nmgp_opcao) || !isset($script_case_init) || ((!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida']) || !$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida']) && $nmgp_opcao != "formphp"))
  4735.    { 
  4736.        if (!empty($nmgp_parms)) 
  4737.        { 
  4738.            $nmgp_parms NM_decode_input($nmgp_parms);
  4739.            $nmgp_parms str_replace("@aspass@""'"$nmgp_parms);
  4740.            $nmgp_parms str_replace("*scout""?@?"$nmgp_parms);
  4741.            $nmgp_parms str_replace("*scin""?#?"$nmgp_parms);
  4742.            $todox str_replace("?#?@?@?""?#?@ ?@?"$nmgp_parms);
  4743.            $todo  explode("?@?"$todox);
  4744.            foreach ($todo as $param)
  4745.            {
  4746.                 $cadapar explode("?#?"$param);
  4747.                 if (sizeof($cadapar))
  4748.                 {
  4749.                     if (substr($cadapar[0], 011) == "SC_glo_par_")
  4750.                     {
  4751.                         $cadapar[0] = substr($cadapar[0], 11);
  4752.                         $cadapar[1] = $_SESSION[$cadapar[1]];
  4753.                     }
  4754.                     if (isset($sc_conv_var[$cadapar[0]]))
  4755.                     {
  4756.                         $cadapar[0] = $sc_conv_var[$cadapar[0]];
  4757.                     }
  4758.                     elseif (isset($sc_conv_var[strtolower($cadapar[0])]))
  4759.                     {
  4760.                         $cadapar[0] = $sc_conv_var[strtolower($cadapar[0])];
  4761.                     }
  4762.                     nm_limpa_str_grid_new($cadapar[1]);
  4763.                     nm_protect_num_grid_new($cadapar[0], $cadapar[1]);
  4764.                     if ($cadapar[1] == "@ ") {$cadapar[1] = trim($cadapar[1]); }
  4765.                     $Tmp_par   $cadapar[0];
  4766.                     $$Tmp_par $cadapar[1];
  4767.                 }
  4768.            }
  4769.            $NMSC_conf_apl = array();
  4770.            if (isset($NMSC_inicial))
  4771.            {
  4772.                $NMSC_conf_apl['inicial'] = $NMSC_inicial;
  4773.            }
  4774.            if (isset($NMSC_rows))
  4775.            {
  4776.                $NMSC_conf_apl['rows'] = $NMSC_rows;
  4777.            }
  4778.            if (isset($NMSC_cols))
  4779.            {
  4780.                $NMSC_conf_apl['cols'] = $NMSC_cols;
  4781.            }
  4782.            if (isset($NMSC_paginacao))
  4783.            {
  4784.                $NMSC_conf_apl['paginacao'] = $NMSC_paginacao;
  4785.            }
  4786.            if (isset($NMSC_cab))
  4787.            {
  4788.                $NMSC_conf_apl['cab'] = $NMSC_cab;
  4789.            }
  4790.            if (isset($NMSC_nav))
  4791.            {
  4792.                $NMSC_conf_apl['nav'] = $NMSC_nav;
  4793.            }
  4794.            if (isset($NM_run_iframe) && $NM_run_iframe == 1
  4795.            { 
  4796.                unset($_SESSION['sc_session'][$script_case_init]['grid_new']);
  4797.                $_SESSION['sc_session'][$script_case_init]['grid_new']['b_sair'] = false;
  4798.            }   
  4799.        } 
  4800.    } 
  4801.    $ini_embutida "";
  4802.    if (isset($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida']) && $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'])
  4803.    {
  4804.        $nmgp_outra_jan "";
  4805.    }
  4806.    if (isset($nmgp_outra_jan) && $nmgp_outra_jan == 'true')
  4807.    {
  4808.        $script_case_init "";
  4809.    }
  4810.    if (isset($GLOBALS["script_case_init"]) && !empty($GLOBALS["script_case_init"]))
  4811.    {
  4812.        $ini_embutida $GLOBALS["script_case_init"];
  4813.         if (!isset($_SESSION['sc_session'][$ini_embutida]['grid_new']['embutida']))
  4814.         { 
  4815.            $_SESSION['sc_session'][$ini_embutida]['grid_new']['embutida'] = false;
  4816.         }
  4817.         if (!$_SESSION['sc_session'][$ini_embutida]['grid_new']['embutida'])
  4818.         { 
  4819.            $script_case_init $ini_embutida;
  4820.         }
  4821.    }
  4822.    if (isset($_SESSION['scriptcase']['grid_new']['protect_modal']) && !empty($_SESSION['scriptcase']['grid_new']['protect_modal']))
  4823.    {
  4824.        $script_case_init $_SESSION['scriptcase']['grid_new']['protect_modal'];
  4825.    }
  4826.    if (!isset($script_case_init) || empty($script_case_init))
  4827.    {
  4828.        $script_case_init rand(210000);
  4829.    }
  4830.    $salva_emb    false;
  4831.    $salva_iframe false;
  4832.    $_SESSION['sc_session'][$script_case_init]['grid_new']['doc_word'] = false;
  4833.    $_SESSION['scriptcase']['saida_word'] = false;
  4834.    if (!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['skip_charts']))
  4835.    {
  4836.        $_SESSION['sc_session'][$script_case_init]['grid_new']['skip_charts'] = false;
  4837.    }
  4838.    if (isset($_REQUEST['sc_create_charts']))
  4839.    {
  4840.        $_SESSION['sc_session'][$script_case_init]['grid_new']['skip_charts'] = 'N' == $_REQUEST['sc_create_charts'];
  4841.    }
  4842.    if (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_menu']))
  4843.    {
  4844.        $salva_iframe $_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_menu'];
  4845.        unset($_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_menu']);
  4846.    }
  4847.    if (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida']))
  4848.    {
  4849.        $salva_emb $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'];
  4850.        unset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida']);
  4851.    }
  4852.    if (isset($nm_run_menu) && $nm_run_menu == && !$salva_emb)
  4853.    {
  4854.         if (isset($_SESSION['scriptcase']['sc_aba_iframe']) && isset($_SESSION['scriptcase']['sc_apl_menu_atual']))
  4855.         {
  4856.             foreach ($_SESSION['scriptcase']['sc_aba_iframe'] as $aba => $apls_aba)
  4857.             {
  4858.                 if ($aba == $_SESSION['scriptcase']['sc_apl_menu_atual'])
  4859.                 {
  4860.                     unset($_SESSION['scriptcase']['sc_aba_iframe'][$aba]);
  4861.                     break;
  4862.                 }
  4863.             }
  4864.         }
  4865.         $_SESSION['scriptcase']['sc_apl_menu_atual'] = "grid_new";
  4866.         $achou false;
  4867.         if (isset($_SESSION['sc_session'][$script_case_init]))
  4868.         {
  4869.             foreach ($_SESSION['sc_session'][$script_case_init] as $nome_apl => $resto)
  4870.             {
  4871.                 if ($nome_apl == 'grid_new' || $achou)
  4872.                 {
  4873.                     unset($_SESSION['sc_session'][$script_case_init][$nome_apl]);
  4874.                 }
  4875.             }
  4876.             if (!$achou && isset($nm_apl_menu))
  4877.             {
  4878.                 foreach ($_SESSION['sc_session'][$script_case_init] as $nome_apl => $resto)
  4879.                 {
  4880.                     if ($nome_apl == $nm_apl_menu || $achou)
  4881.                     {
  4882.                         $achou true;
  4883.                         if ($nome_apl != $nm_apl_menu)
  4884.                         {
  4885.                             unset($_SESSION['sc_session'][$script_case_init][$nome_apl]);
  4886.                         }
  4887.                     }
  4888.                 }
  4889.             }
  4890.         }
  4891.         $_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_menu'] = true;
  4892.    }
  4893.    else
  4894.    {
  4895.        $_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_menu'] = $salva_iframe;
  4896.    }
  4897.    $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'] = $salva_emb;

  4898.    if (!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['initialize']))
  4899.    {
  4900.        $_SESSION['sc_session'][$script_case_init]['grid_new']['initialize'] = true;
  4901.    }
  4902.    elseif (!isset($_SERVER['HTTP_REFERER']))
  4903.    {
  4904.        $_SESSION['sc_session'][$script_case_init]['grid_new']['initialize'] = false;
  4905.    }
  4906.    elseif (false === strpos($_SERVER['HTTP_REFERER'], '/grid_new/'))
  4907.    {
  4908.        $_SESSION['sc_session'][$script_case_init]['grid_new']['initialize'] = true;
  4909.    }
  4910.    else
  4911.    {
  4912.        $_SESSION['sc_session'][$script_case_init]['grid_new']['initialize'] = false;
  4913.    }
  4914.    if ($_SESSION['sc_session'][$script_case_init]['grid_new']['initialize'])
  4915.    {
  4916.        unset($_SESSION['sc_session'][$script_case_init]['grid_new']['tot_geral']);
  4917.        $_SESSION['sc_session'][$script_case_init]['grid_new']['contr_total_geral'] = "NAO";
  4918.    }

  4919.    $_POST['script_case_init'] = $script_case_init;
  4920.    if (isset($nmgp_opcao) && $nmgp_opcao == "busca" && isset($nmgp_orig_pesq))
  4921.    {
  4922.        $_SESSION['sc_session'][$script_case_init]['grid_new']['orig_pesq'] = $nmgp_orig_pesq;
  4923.    }
  4924.    if (!isset($nmgp_opcao) || empty($nmgp_opcao) || $nmgp_opcao == "grid" && (!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['b_sair'])))
  4925.    {
  4926.        $_SESSION['sc_session'][$script_case_init]['grid_new']['b_sair'] = true;
  4927.    }
  4928.    if (isset($_SESSION['scriptcase']['sc_outra_jan']) && $_SESSION['scriptcase']['sc_outra_jan'] == 'grid_new')
  4929.    {
  4930.        $_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan'] = true;
  4931.         unset($_SESSION['scriptcase']['sc_outra_jan']);
  4932.    }
  4933.    $_SESSION['sc_session'][$script_case_init]['grid_new']['menu_desenv'] = false;   
  4934.    if (!defined("SC_ERROR_HANDLER"))
  4935.    {
  4936.        define("SC_ERROR_HANDLER"1);
  4937.        include_once(dirname(__FILE__) . "/grid_new_erro.php");
  4938.    }
  4939.    $salva_tp_saida  = (isset($_SESSION['scriptcase']['sc_tp_saida']))  ? $_SESSION['scriptcase']['sc_tp_saida'] : "";
  4940.    $salva_url_saida  = (isset($_SESSION['scriptcase']['sc_url_saida'][$script_case_init])) ? $_SESSION['scriptcase']['sc_url_saida'][$script_case_init] : "";
  4941.    if (isset($_SESSION['sc_session']['scriptcase']['embutida_form_pdf']['grid_new']))
  4942.    { 
  4943.        return;
  4944.    } 
  4945.    if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'] && $nmgp_opcao != "formphp")
  4946.    { 
  4947.        if ($nmgp_opcao == "change_lang" || $nmgp_opcao == "change_lang_res" || $nmgp_opcao == "change_lang_fil" || $nmgp_opcao == "force_lang")  
  4948.        { 
  4949.            if ($nmgp_opcao == "change_lang_fil")  
  4950.            { 
  4951.                $nmgp_opcao  "busca";  
  4952.            } 
  4953.            elseif ($nmgp_opcao == "change_lang_res")  
  4954.            { 
  4955.                $nmgp_opcao  "resumo";  
  4956.            } 
  4957.            else 
  4958.            { 
  4959.                $nmgp_opcao  "igual";  
  4960.            } 
  4961.            $_SESSION['sc_session'][$script_case_init]['grid_new']['sc_change_lang'] = true;
  4962.            unset($_SESSION['sc_session'][$script_case_init]['grid_new']['tot_geral']);
  4963.            $_SESSION['sc_session'][$script_case_init]['grid_new']['contr_total_geral'] = "NAO";
  4964.            $Temp_lang explode(";" $nmgp_idioma);  
  4965.            if (isset($Temp_lang[0]) && !empty($Temp_lang[0]))  
  4966.            { 
  4967.                $_SESSION['scriptcase']['str_lang'] = $Temp_lang[0];
  4968.            } 
  4969.            if (isset($Temp_lang[1]) && !empty($Temp_lang[1])) 
  4970.            { 
  4971.                $_SESSION['scriptcase']['str_conf_reg'] = $Temp_lang[1];
  4972.            } 
  4973.        } 
  4974.        if ($nmgp_opcao == "change_schema" || $nmgp_opcao == "change_schema_fil" || $nmgp_opcao == "change_schema_res")  
  4975.        { 
  4976.            if ($nmgp_opcao == "change_schema_fil")  
  4977.            { 
  4978.                $nmgp_opcao  "busca";  
  4979.            } 
  4980.            elseif ($nmgp_opcao == "change_schema_res")  
  4981.            { 
  4982.                $nmgp_opcao  "resumo";  
  4983.            } 
  4984.            else 
  4985.            { 
  4986.                $nmgp_opcao  "igual";  
  4987.            } 
  4988.            $nmgp_schema $nmgp_schema "/" $nmgp_schema;  
  4989.            $_SESSION['scriptcase']['str_schema_all'] = $nmgp_schema;
  4990.            $_SESSION['sc_session'][$script_case_init]['grid_new']['num_css'] = rand(01000);
  4991.        } 
  4992.        if ($nmgp_opcao == "volta_grid")  
  4993.        { 
  4994.            $nmgp_opcao "igual";  
  4995.        }   
  4996.        if (!empty($nmgp_opcao))  
  4997.        { 
  4998.            $_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] = $nmgp_opcao ;  
  4999.        }   
  5000.        if ($_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] == "detalhe" && isset($nmgp_chave_det))  
  5001.        { 
  5002.            $_SESSION['sc_session'][$script_case_init]['grid_new']['chave_det'] = $nmgp_chave_det;
  5003.            $_SESSION['sc_session'][$script_case_init]['grid_new']['cmp_acum']  = $nmgp_parm_acum;
  5004.        }   
  5005.        if (isset($Sc_seq_det))  
  5006.        { 
  5007.            $_SESSION['sc_session'][$script_case_init]['grid_new']['Sc_seq_det'] = $Sc_seq_det;
  5008.        } 
  5009.        if (isset($nmgp_lig_edit_lapis)) 
  5010.        {
  5011.           $_SESSION['sc_session'][$script_case_init]['grid_new']['mostra_edit'] = $nmgp_lig_edit_lapis;
  5012.            unset($GLOBALS["nmgp_lig_edit_lapis"]) ;  
  5013.            if (isset($_SESSION['nmgp_lig_edit_lapis'])) 
  5014.            {
  5015.                unset($_SESSION['nmgp_lig_edit_lapis']);
  5016.            }
  5017.        }
  5018.        if (isset($nmgp_outra_jan) && $nmgp_outra_jan == 'true')
  5019.        {
  5020.            $_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan'] = true;
  5021.        }
  5022.        $nm_saida "";
  5023.        if (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['volta_redirect_apl']) && !empty($_SESSION['sc_session'][$script_case_init]['grid_new']['volta_redirect_apl']))
  5024.        {
  5025.            $_SESSION['scriptcase']['sc_url_saida'][$script_case_init] = $_SESSION['sc_session'][$script_case_init]['grid_new']['volta_redirect_apl']; 
  5026.            $nm_apl_dependente $_SESSION['sc_session'][$script_case_init]['grid_new']['volta_redirect_tp']; 
  5027.            $_SESSION['sc_session'][$script_case_init]['grid_new']['volta_redirect_apl'] = "";
  5028.            $_SESSION['sc_session'][$script_case_init]['grid_new']['volta_redirect_tp'] = "";
  5029.            $nm_url_saida "grid_new_fim.php"
  5030.        
  5031.        }
  5032.        elseif (substr($_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'], 07) != "grafico" && $_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] != "pdf" 
  5033.        {
  5034.            if (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan']) && $_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan'])
  5035.            {
  5036.                if ($nmgp_url_saida == "modal")
  5037.                {
  5038.                    $_SESSION['sc_session'][$script_case_init]['grid_new']['sc_modal'] = true;
  5039.                }
  5040.                $nm_url_saida "grid_new_fim.php"
  5041.            }
  5042.            else
  5043.            {
  5044.                $nm_url_saida = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""
  5045.                $nm_url_saida str_replace("_fim.php"".php"$nm_url_saida);
  5046.                if (!empty($nmgp_url_saida)) 
  5047.                { 
  5048.                    $_SESSION['sc_session'][$script_case_init]['grid_new']['retorno_cons'] = $nmgp_url_saida 
  5049.                } 
  5050.                if (!empty($_SESSION['sc_session'][$script_case_init]['grid_new']['retorno_cons'])) 
  5051.                { 
  5052.                    $nm_url_saida $_SESSION['sc_session'][$script_case_init]['grid_new']['retorno_cons']  . "?script_case_init=" NM_encode_input($script_case_init);  
  5053.                    $nm_apl_dependente 
  5054.                } 
  5055.                if (!empty($nm_url_saida)) 
  5056.                { 
  5057.                    $_SESSION['scriptcase']['sc_url_saida'][$script_case_init] = $nm_url_saida 
  5058.                } 
  5059.                $_SESSION['scriptcase']['sc_url_saida'][$script_case_init] = $nm_url_saida
  5060.                $nm_url_saida "grid_new_fim.php"
  5061.                $_SESSION['scriptcase']['sc_tp_saida'] = "P"
  5062.                if ($nm_apl_dependente == 1
  5063.                { 
  5064.                    $_SESSION['scriptcase']['sc_tp_saida'] = "D"
  5065.                } 
  5066.            } 
  5067.        }
  5068. // 
  5069.        if (isset($_SESSION['scriptcase']['nm_sc_retorno']) && !empty($_SESSION['scriptcase']['nm_sc_retorno']) && $nm_apl_dependente != && substr($_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'], 07) != "grafico" && $_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] != "pdf" 
  5070.        { 
  5071.             $_SESSION['scriptcase']['sc_url_saida'][$script_case_init] = $_SESSION['scriptcase']['nm_sc_retorno']; 
  5072.             $_SESSION['sc_session'][$script_case_init]['grid_new']['menu_desenv'] = true;   
  5073.        } 
  5074.        if (isset($nmgp_parms_ret)) 
  5075.        {
  5076.            $todo explode(","$nmgp_parms_ret);
  5077.            if (isset($sc_conv_var[$todo[2]]))
  5078.            {
  5079.                $todo[2] = $sc_conv_var[$todo[2]];
  5080.            }
  5081.            elseif (isset($sc_conv_var[strtolower($todo[2])]))
  5082.            {
  5083.                $todo[2] = $sc_conv_var[strtolower($todo[2])];
  5084.            }
  5085.            $_SESSION['sc_session'][$script_case_init]['grid_new']['form_psq_ret']  = $todo[0];
  5086.            $_SESSION['sc_session'][$script_case_init]['grid_new']['campo_psq_ret'] = $todo[1];
  5087.            $_SESSION['sc_session'][$script_case_init]['grid_new']['dado_psq_ret']  = $todo[2];
  5088.            $_SESSION['sc_session'][$script_case_init]['grid_new']['js_apos_busca'] = $nm_evt_ret_busca;
  5089.            $_SESSION['sc_session'][$script_case_init]['grid_new']['opc_psq'] = true;   
  5090.            if (isset($nmgp_iframe_ret)) 
  5091.            {
  5092.                $_SESSION['sc_session'][$script_case_init]['grid_new']['iframe_ret_cap'] = $nmgp_iframe_ret;
  5093.            }
  5094.        } 
  5095.        elseif (!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['opc_psq']))
  5096.        {
  5097.            $_SESSION['sc_session'][$script_case_init]['grid_new']['opc_psq'] = false ;   
  5098.        } 
  5099.        if (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form']) && $_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form'])
  5100.        {
  5101.            if (!isset($_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_full']) || !$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida_form_full'])
  5102.            {
  5103.                $_SESSION['sc_session'][$script_case_init]['grid_new']['mostra_edit'] = "N";   
  5104.            } 
  5105.            $_SESSION['scriptcase']['sc_tp_saida']  = $salva_tp_saida;
  5106.            $_SESSION['scriptcase']['sc_url_saida'][$script_case_init] = $salva_url_saida;
  5107.        } 
  5108.        $GLOBALS["NM_ERRO_IBASE"] = 0;  
  5109.        if (isset($_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan']) && $_SESSION['sc_session'][$script_case_init]['grid_new']['sc_outra_jan'])
  5110.        {
  5111.            $nm_apl_dependente 0;
  5112.        }
  5113.        $contr_grid_new = new grid_new_apl();

  5114.       if ('ajax_autocomp' == $nmgp_opcao)
  5115.       {
  5116.           $nmgp_opcao 'busca';
  5117.           $_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] = "busca";
  5118.           $contr_grid_new->NM_ajax_flag true;
  5119.           $contr_grid_new->NM_ajax_opcao $NM_ajax_opcao;
  5120.       }
  5121.       if ('ajax_filter_save' == $nmgp_opcao)
  5122.       {
  5123.           $nmgp_opcao 'busca';
  5124.           $_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] = "busca";
  5125.           $contr_grid_new->NM_ajax_flag true;
  5126.           $contr_grid_new->NM_ajax_opcao "ajax_filter_save";
  5127.       }
  5128.       if ('ajax_filter_delete' == $nmgp_opcao)
  5129.       {
  5130.           $nmgp_opcao 'busca';
  5131.           $_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] = "busca";
  5132.           $contr_grid_new->NM_ajax_flag true;
  5133.           $contr_grid_new->NM_ajax_opcao "ajax_filter_delete";
  5134.       }
  5135.       if ('ajax_filter_select' == $nmgp_opcao)
  5136.       {
  5137.           $nmgp_opcao 'busca';
  5138.           $_SESSION['sc_session'][$script_case_init]['grid_new']['opcao'] = "busca";
  5139.           $contr_grid_new->NM_ajax_flag true;
  5140.           $contr_grid_new->NM_ajax_opcao "ajax_filter_select";
  5141.       }
  5142.        $contr_grid_new->controle();
  5143.    } 
  5144.    if (!$_SESSION['sc_session'][$script_case_init]['grid_new']['embutida'] && $nmgp_opcao == "formphp")
  5145.    { 
  5146.        $GLOBALS["NM_ERRO_IBASE"] = 0;  
  5147.        $contr_grid_new = new grid_new_apl();
  5148.        $contr_grid_new->controle();
  5149.    } 
  5150. //
  5151.    function nm_limpa_str_grid_new(&$str)
  5152.    {
  5153.        if (get_magic_quotes_gpc())
  5154.        {
  5155.            if (is_array($str))
  5156.            {
  5157.                foreach ($str as $x => $cada_str)
  5158.                {
  5159.                    $str[$x] = str_replace("@aspasd@"'"'$str[$x]);
  5160.                    $str[$x] = stripslashes($str[$x]);
  5161.                }
  5162.            }
  5163.            else
  5164.            {
  5165.                $str str_replace("@aspasd@"'"'$str);
  5166.                $str stripslashes($str);
  5167.            }
  5168.        }
  5169.    }
  5170.    function nm_protect_num_grid_new($name, &$val)
  5171.    {
  5172.        if (empty($val))
  5173.        {
  5174.           return;
  5175.        }
  5176.        $Nm_numeric = array();
  5177.        $Nm_numeric[] = "proprietarios_idproprietario";
  5178.        $Nm_numeric[] = "proprietarios_cpf";
  5179.        $Nm_numeric[] = "veiculos_idveiculos";
  5180.        $Nm_numeric[] = "veiculos_idproprietario_fk";
  5181.        if (in_array($name$Nm_numeric))
  5182.        {
  5183.            if (is_array($val))
  5184.            {
  5185.                foreach ($val as $cada_val)
  5186.                {
  5187.                   $tmp_pos strpos($cada_val"##@@");
  5188.                   if ($tmp_pos !== false)
  5189.                    {
  5190.                       $cada_val substr($cada_val0$tmp_pos);
  5191.                   }
  5192.                   for ($x 0$x strlen($cada_val); $x++)
  5193.                   {
  5194.                       if (($cada_val[$x] < || $cada_val[$x] > 9) && $cada_val[$x] != "."  && $cada_val[$x] != "," && $cada_val[$x] != "-")
  5195.                       {
  5196.                           $val = array();
  5197.                           return;
  5198.                       }
  5199.                    }
  5200.                }
  5201.                return;
  5202.            }
  5203.            $cada_val $val;
  5204.            $tmp_pos strpos($cada_val"##@@");
  5205.            if ($tmp_pos !== false)
  5206.             {
  5207.                $cada_val substr($cada_val0$tmp_pos);
  5208.            }
  5209.            for ($x 0$x strlen($cada_val); $x++)
  5210.            {
  5211.                if (($cada_val[$x] < || $cada_val[$x] > 9) && $cada_val[$x] != "."  && $cada_val[$x] != "," && $cada_val[$x] != "-")
  5212.                {
  5213.                    $val 0;
  5214.                    return;
  5215.                }
  5216.            }
  5217.        }
  5218.    }
  5219.    function grid_new_pack_protect_string($sString)
  5220.    {
  5221.       $sString = (string) $sString;
  5222.       if (!empty($sString))
  5223.       {
  5224.          if (function_exists('NM_is_utf8') && NM_is_utf8($sString))
  5225.          {
  5226.              return $sString;
  5227.          }
  5228.          else
  5229.          {
  5230.              return sc_htmlentities($sString);
  5231.          }
  5232.       }
  5233.       elseif ('0' === $sString || === $sString)
  5234.       {
  5235.          return '0';
  5236.       }
  5237.       else
  5238.       {
  5239.          return '';
  5240.       }
  5241.    }
  5242. ?>
Return